[
  {
    "path": ".gitattributes",
    "content": "###############################################################################\n# Set default behavior to automatically normalize line endings.\n###############################################################################\n* text=auto\n\n###############################################################################\n# Set default behavior for command prompt diff.\n#\n# This is need for earlier builds of msysgit that does not have it on by\n# default for csharp files.\n# Note: This is only used by command line\n###############################################################################\n#*.cs     diff=csharp\n\n###############################################################################\n# Set the merge driver for project and solution files\n#\n# Merging from the command prompt will add diff markers to the files if there\n# are conflicts (Merging from VS is not affected by the settings below, in VS\n# the diff markers are never inserted). Diff markers may cause the following \n# file extensions to fail to load in VS. An alternative would be to treat\n# these files as binary and thus will always conflict and require user\n# intervention with every merge. To do so, just uncomment the entries below\n###############################################################################\n#*.sln       merge=binary\n#*.csproj    merge=binary\n#*.vbproj    merge=binary\n#*.vcxproj   merge=binary\n#*.vcproj    merge=binary\n#*.dbproj    merge=binary\n#*.fsproj    merge=binary\n#*.lsproj    merge=binary\n#*.wixproj   merge=binary\n#*.modelproj merge=binary\n#*.sqlproj   merge=binary\n#*.wwaproj   merge=binary\n\n###############################################################################\n# behavior for image files\n#\n# image files are treated as binary by default.\n###############################################################################\n#*.jpg   binary\n#*.png   binary\n#*.gif   binary\n\n###############################################################################\n# diff behavior for common document formats\n# \n# Convert binary document formats to text before diffing them. This feature\n# is only available from the command line. Turn it on by uncommenting the \n# entries below.\n###############################################################################\n#*.doc   diff=astextplain\n#*.DOC   diff=astextplain\n#*.docx  diff=astextplain\n#*.DOCX  diff=astextplain\n#*.dot   diff=astextplain\n#*.DOT   diff=astextplain\n#*.pdf   diff=astextplain\n#*.PDF   diff=astextplain\n#*.rtf   diff=astextplain\n#*.RTF   diff=astextplain\n"
  },
  {
    "path": ".github/FUNDING.yml",
    "content": "github: zeeex\n"
  },
  {
    "path": ".github/dependabot.yml",
    "content": "# To get started with Dependabot version updates, you'll need to specify which\n# package ecosystems to update and where the package manifests are located.\n# Please see the documentation for all configuration options:\n# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates\n\nversion: 2\nupdates:\n  - package-ecosystem: \"nuget\" # See documentation for possible values\n    directory: \"/\" # Location of package manifests\n    schedule:\n      interval: \"monthly\"\n"
  },
  {
    "path": ".github/workflows/dotnet.yml",
    "content": "name: .NET\n\non:\n  push:\n    branches: [ master ]\n  pull_request:\n    branches: [ master ]\n\njobs:\n  build:\n\n    runs-on: ubuntu-latest\n\n    steps:\n    - uses: actions/checkout@v2\n    - name: Setup .NET\n      uses: actions/setup-dotnet@v1\n      with:\n        dotnet-version: 3.1.301\n    - name: Restore dependencies\n      run: dotnet restore\n    - name: Build\n      run: dotnet build --no-restore\n    - name: Test\n      run: dotnet test --no-build --verbosity normal\n"
  },
  {
    "path": ".gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n\n# User-specific files\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nx64/\nx86/\nbld/\n[Bb]in/\n[Oo]bj/\n[Ll]og/\n\n# Visual Studio 2015 cache/options directory\n.vs/\n# Uncomment if you have tasks that create the project's static files in wwwroot\n#wwwroot/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUNIT\n*.VisualState.xml\nTestResult.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n# DNX\nproject.lock.json\nproject.fragment.lock.json\nartifacts/\n\n*_i.c\n*_p.c\n*_i.h\n*.ilk\n*.meta\n*.obj\n*.pch\n*.pdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*.log\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opendb\n*.opensdf\n*.sdf\n*.cachefile\n*.VC.db\n*.VC.VC.opendb\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n*.sap\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# JustCode is a .NET coding add-in\n.JustCode\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\nnCrunchTemp_*\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# TODO: Comment the next line if you want to checkin your web deploy settings\n# but database connection strings (with potential passwords) will be unencrypted\n#*.pubxml\n*.publishproj\n\n# Microsoft Azure Web App publish settings. Comment the next line if you want to\n# checkin your Azure Web App publish settings, but sensitive information contained\n# in these scripts will be unencrypted\nPublishScripts/\n\n# NuGet Packages\n*.nupkg\n# The packages folder can be ignored because of Package Restore\n**/packages/*\n# except build/, which is used as an MSBuild target.\n!**/packages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/packages/repositories.config\n# NuGet v3's project.json files produces more ignoreable files\n*.nuget.props\n*.nuget.targets\n\n# Microsoft Azure Build Output\ncsx/\n*.build.csdef\n\n# Microsoft Azure Emulator\necf/\nrcf/\n\n# Windows Store app package directories and files\nAppPackages/\nBundleArtifacts/\nPackage.StoreAssociation.xml\n_pkginfo.txt\n\n# Visual Studio cache files\n# files ending in .cache can be ignored\n*.[Cc]ache\n# but keep track of directories ending in .cache\n!*.[Cc]ache/\n\n# Others\nClientBin/\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.jfm\n*.pfx\n*.publishsettings\nnode_modules/\norleans.codegen.cs\n\n# Since there are multiple workflows, uncomment next line to ignore bower_components\n# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)\n#bower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\n\n# SQL Server files\n*.mdf\n*.ldf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# GhostDoc plugin setting file\n*.GhostDoc.xml\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n\n# Visual Studio LightSwitch build output\n**/*.HTMLClient/GeneratedArtifacts\n**/*.DesktopClient/GeneratedArtifacts\n**/*.DesktopClient/ModelManifest.xml\n**/*.Server/GeneratedArtifacts\n**/*.Server/ModelManifest.xml\n_Pvt_Extensions\n\n# Paket dependency manager\n.paket/paket.exe\npaket-files/\n\n# FAKE - F# Make\n.fake/\n\n# JetBrains Rider\n.idea/\n*.sln.iml\n\n# CodeRush\n.cr/\n\n# Python Tools for Visual Studio (PTVS)\n__pycache__/\n*.pyc"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://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 <http://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<http://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<http://www.gnu.org/philosophy/why-not-lgpl.html>.\n"
  },
  {
    "path": "README.md",
    "content": "<h1 align=\"center\">\nXTR Toolbox\n</h1>\n<p align=\"center\">\nPortable tool to tweak, clean and optimize Windows.\n<br>🚀 E<b>xtr</b>emely fast. 🚀\n<br>\n<br>\n<img alt=\"GitHub all releases\" src=\"https://img.shields.io/github/downloads/zeeex/xtr-toolbox/total\"> \n<a href=\"https://github.com/Zeeex/XTR-Toolbox/releases/latest\">\n<img alt=\"GitHub release (latest by date)\" src=\"https://img.shields.io/github/v/release/zeeex/xtr-toolbox\">\n</a>\n<a href=\"https://github.com/Zeeex/XTR-Toolbox/issues\">\n<img alt=\"GitHub issues\" src=\"https://img.shields.io/github/issues/zeeex/xtr-toolbox\">\n<img alt=\"GitHub license\" src=\"https://img.shields.io/github/license/zeeex/xtr-toolbox\"> \n</a>\n<br>\n<br>\n<img src=\"XTR_main_screenshot.png\">\n</p>\n\n## Supported platforms:\n- Windows 10, Windows 11 - x64 only (Use **v2.1** for x32)\n- .Net Framework: 4.8 (Included with Windows 10 1903+)\n- (Note: **Windows 7 && Windows 8** support is deprecated)\n\n## Features Overview:\n\n#### Main Tools:\n- Batch Startup Manager\n  - Create startup entries\n  - Log startup changes\n  - Export startup list [Clipboard]\n  - Displays invalid entries\n- Batch Services Manager\n  - Log service changes\n  - Export services list [Clipboard]\n- Batch Software Manager\n  - Log software changes\n  - Export software list [Clipboard]\n  - Force remove software\n  - Silently remove software (MSI)\n- Hosts File Editor / Manager\n- Quick Tools\n  - Rebuild Icon Cache\n  - Rebuild Font Cache\n  - Reset Event Logs\n\n#### Privacy Tools:\n- Remove / Reinstall Windows Apps\n  - Detects currently present apps\n\n#### Cleanup Tools: \n- Junk Files Cleaner:\n  - Filter by date\n  - Filter by custom extensions\n  - Cleaning support:\n    - User and Windows Temporary Directories\n    - Windows Installer Cache\n    - Windows Update Cache\n    - Windows Logs Directory\n    - Prefetch Cache\n    - Crash Dump Directory\n    - Google Chrome Cache\n    - Steam Redistributable Packages\n- Chrome Extensions Manager\n\n#### Other:\n- Automatic Dark / Light mode (Also configurable)\n\n## What sets this toolbox apart from many others?\nUnlike other apps, this toolbox aims to:\n- Be fast and lightweight regardless of feature set\n- Use modern technologies\n- Have no ads, unnecessary things, or bloat\n- Support latest version of Windows\n- Be easy to use and have a good looking interface\n\n## Project Goals - Plans\n- To add a lot more features (see backlog)\n- Translate to other languages\n- Help wiki\n- You can request a feature, open for all kinds of suggestions\n- Get feature parity with other toolbox suites\n\n## Support me if you enjoy my software or spread the word\n<a href=\"https://github.com/sponsors/Zeeex\">\nBecome a GitHub sponsor\n</a>\n<br>\nEvery bit helps and will enable me to focus more time on development.\n<br>\n\n## Backlog\nSoftware manager:\n- Software update checker & downloader\n- Automatically download and install software (with configuration per setup)\n- Batch software installer\n- More control over force uninstalling\n- Detection of different installers and uninstallers (Inno, NSIS, Msi,...)\n\nServices manager:\n- Preset services changer (Batch services changes based on definition file)\n- Services progress bar when changing\n- Better error handling\n- Add color coding for easier management of their change severity and recommendation\n- Add memory usage for running services\n\nAutoruns manager:\n- Check startup entries against known definition file for their validity (hosted on github)\n- More options when creating a new startup entry\n\nJunk Files Cleaner:\n- Improve scanning process (offer to cancel, improve scan progress)\n\nGeneral:\n- Add a post scan / clean / tweak option (like restarting / shutting down PC)\n- Add a CLI interface for all tools\n- Add a logger so the user can report bugs / features easily\n- Add option to disable / tweak Windows bloat (all range of options)\n- Add option to manage invalid shortcuts (remove and repair)\n- Add option to manage context menu items (remove, change, and repair)\n- Add option to change windows theme (dark/light) based on timed settings\n- Add option to save / restore desktop icons and their layout\n- Add option to export data to all kind of formats (text, csv, xml, json, xlsx)\n- Add autoupdater (user changeable)\n- Add duplicate files finder\n- Add checksum files comparer (MD5, SHA1, SHA2, ...)\n- Add option to save configuration (file / registry config) (this is still under consideration)\n- Add option to schedule tools to run at specified time (using Task Scheduler)\n- Add option to run several tools in succession\n- Add option for scripts so any user can add their own tweaks to the tool\n- Improve scan speed for all tools\n\n## Download\nLatest release [page](https://github.com/Zeeex/XTR-Toolbox/releases/latest).\n\n## Build tools\n- Visual Studio 2022 (Probably works on older versions too)\n- Windows 10 SDK (Project requests by default 10.0.18362.0 (Win 1903)) - Integrated into project\n\n## Reviews\n- [MajorGeeks](http://www.majorgeeks.com/files/details/xtr_toolbox.html) </br>\n- [Softpedia](http://www.softpedia.com/get/PORTABLE-SOFTWARE/System/System-Enhancements/XTR-Toolbox.shtml) </br>\n- [chip.de](http://www.chip.de/downloads/XTR-Toolbox_131625845.html) - [Rated best freeware](http://www.chip.de/bildergalerie/Freeware-des-Monats-2018-Galerie_130718114.html) of february 2018, [v2.1 Review](http://www.chip.de/news/Update-fuer-XTR-Toolbox-CCleaner-Alternative-entfernt-Windows-Apps-noch-zuverlaessiger_131614814.html) </br>\n- [Trishtech.com](https://www.trishtech.com/2018/01/xtr-toolbox-portable-windows-tweaker-and-optimizer/) </br>\n- [WinTotal.de](https://www.wintotal.de/download/xtr-toolbox/)\n"
  },
  {
    "path": "XTR_Toolbox/App.config",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<configuration>\n    <startup> \n        <supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.7\"/>\n    </startup>\n</configuration>\n"
  },
  {
    "path": "XTR_Toolbox/App.xaml",
    "content": "﻿<Application x:Class=\"XTR_Toolbox.App\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             StartupUri=\"MainWindow.xaml\" ShutdownMode=\"OnMainWindowClose\">\n    <Application.Resources>\n        <ResourceDictionary>\n            <ResourceDictionary.MergedDictionaries>\n                <ResourceDictionary Source=\"pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml\" />\n                <ResourceDictionary Source=\"pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml\" />\n                <ResourceDictionary Source=\"pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml\" />\n                <ResourceDictionary Source=\"pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml\" />\n                <ResourceDictionary Source=\"pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Light.xaml\" />\n                <ResourceDictionary Source=\"pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml\" />\n                <ResourceDictionary Source=\"pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Primary/MaterialDesignColor.Brown.xaml\" />\n                <ResourceDictionary Source=\"pack://application:,,,/MaterialDesignColors;component/Themes/Recommended/Accent/MaterialDesignColor.Yellow.xaml\" />\n                <ResourceDictionary Source=\"pack://application:,,,/MaterialDesignThemes.MahApps;component/Themes/MaterialDesignTheme.MahApps.Fonts.xaml\" />\n            </ResourceDictionary.MergedDictionaries>\n            <SolidColorBrush x:Key=\"HighlightBrush\" Color=\"{DynamicResource Primary700}\"/>\n            <SolidColorBrush x:Key=\"AccentColorBrush\" Color=\"{DynamicResource Primary500}\"/>\n            <SolidColorBrush x:Key=\"AccentColorBrush2\" Color=\"{DynamicResource Primary400}\"/>\n            <SolidColorBrush x:Key=\"AccentColorBrush3\" Color=\"{DynamicResource Primary300}\"/>\n            <SolidColorBrush x:Key=\"AccentColorBrush4\" Color=\"{DynamicResource Primary200}\"/>\n            <SolidColorBrush x:Key=\"WindowTitleColorBrush\" Color=\"{DynamicResource Primary700}\"/>\n            <SolidColorBrush x:Key=\"AccentSelectedColorBrush\" Color=\"{DynamicResource Primary500Foreground}\"/>\n            <LinearGradientBrush x:Key=\"ProgressBrush\" EndPoint=\"0.001,0.5\" StartPoint=\"1.002,0.5\">\n                <GradientStop Color=\"{DynamicResource Primary700}\" Offset=\"0\"/>\n                <GradientStop Color=\"{DynamicResource Primary300}\" Offset=\"1\"/>\n            </LinearGradientBrush>\n            <SolidColorBrush x:Key=\"CheckmarkFill\" Color=\"{DynamicResource Primary500}\"/>\n            <SolidColorBrush x:Key=\"RightArrowFill\" Color=\"{DynamicResource Primary500}\"/>\n            <SolidColorBrush x:Key=\"IdealForegroundColorBrush\" Color=\"{DynamicResource Primary500Foreground}\"/>\n            <SolidColorBrush x:Key=\"IdealForegroundDisabledBrush\" Color=\"{DynamicResource Primary500}\" Opacity=\"0.4\"/>\n        </ResourceDictionary>\n    </Application.Resources>\n</Application>"
  },
  {
    "path": "XTR_Toolbox/App.xaml.cs",
    "content": "﻿namespace XTR_Toolbox\n{\n    public partial class App\n    {\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Classes/ColumnSorter.cs",
    "content": "﻿using System.ComponentModel;\nusing System.Windows;\nusing System.Windows.Documents;\nusing System.Windows.Media;\n\nnamespace XTR_Toolbox.Classes\n{\n    public class SortAdorner : Adorner\n    {\n        private static readonly Geometry AscGeometry = Geometry.Parse(\"M 0 4 L 3.5 0 L 7 4 Z\");\n\n        private static readonly Geometry DescGeometry = Geometry.Parse(\"M 0 0 L 3.5 4 L 7 0 Z\");\n\n        public SortAdorner(UIElement element, ListSortDirection dir) : base(element) => Direction = dir;\n\n        public ListSortDirection Direction { get; }\n\n        protected override void OnRender(DrawingContext drawingContext)\n        {\n            base.OnRender(drawingContext);\n\n            if (AdornedElement.RenderSize.Width < 20)\n                return;\n\n            TranslateTransform transform = new TranslateTransform\n            (\n                AdornedElement.RenderSize.Width - 15,\n                (AdornedElement.RenderSize.Height - 5) / 2\n            );\n            drawingContext.PushTransform(transform);\n\n            Geometry geometry = AscGeometry;\n            if (Direction == ListSortDirection.Descending)\n                geometry = DescGeometry;\n            drawingContext.DrawGeometry(Brushes.Black, null, geometry);\n\n            drawingContext.Pop();\n        }\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Classes/Converters.cs",
    "content": "﻿using System;\nusing System.Globalization;\nusing System.Windows;\nusing System.Windows.Data;\n\nnamespace XTR_Toolbox.Classes\n{\n    internal class StringVisibilityConverter : IValueConverter\n    {\n        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n            => string.IsNullOrEmpty((string) value) ? Visibility.Collapsed : Visibility.Visible;\n\n        public object ConvertBack(object value, Type targetType, object parameter,\n            CultureInfo culture) => Binding.DoNothing;\n    }\n\n    internal class DoubleVisibilityConverter : IValueConverter\n    {\n        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)\n        {\n            if (value == null) return null;\n            return Math.Abs((double) value) < 0.01 ? Visibility.Collapsed : Visibility.Visible;\n        }\n\n        public object ConvertBack(object value, Type targetType, object parameter,\n            CultureInfo culture) => Binding.DoNothing;\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Classes/CustomProc.cs",
    "content": "﻿using System;\nusing System.Diagnostics;\nusing System.Windows;\n\nnamespace XTR_Toolbox.Classes\n{\n    internal static class CustomProc\n    {\n        public static int StartProc(string file, string arg = \"\", ProcessWindowStyle style = ProcessWindowStyle.Normal,\n            string exMsg = \"\", bool wait = true)\n        {\n            ProcessStartInfo startInfo = new ProcessStartInfo\n            {\n                FileName = file,\n                Arguments = arg,\n                WindowStyle = style\n            };\n\n            using (Process proc = new Process())\n            {\n                try\n                {\n                    proc.StartInfo = startInfo;\n                    proc.Start();\n                    if (wait)\n                        proc.WaitForExit();\n                }\n                catch (Exception ex)\n                {\n                    MessageBox.Show($\"{exMsg}Error: {ex.Message}\");\n                }\n\n                return proc.ExitCode;\n            }\n        }\n\n        public static void KillAllProc(string procName)\n        {\n            try\n            {\n                foreach (Process processKill in Process.GetProcessesByName(procName))\n                    processKill.Kill();\n            }\n            catch\n            {\n                // ignored\n            }\n        }\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Classes/Shared.cs",
    "content": "﻿using System;\nusing System.IO;\nusing System.Linq;\nusing System.ServiceProcess;\nusing System.Threading;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Interop;\nusing System.Windows.Media.Imaging;\nusing MaterialDesignThemes.Wpf;\nusing Microsoft.Win32;\nusing Icon = System.Drawing.Icon;\n\nnamespace XTR_Toolbox.Classes\n{\n    internal static class Shared\n    {\n        private static int _tipCount;\n\n        internal static BitmapSource PathToIcon(string filePath)\n        {\n            if (string.IsNullOrEmpty(filePath))\n                return null;\n            if (!File.Exists(filePath))\n            {\n                int commaIndex = filePath.LastIndexOf(\",\", filePath.Length - 2, StringComparison.Ordinal);\n\n                if (commaIndex >= 0)\n                    filePath = filePath.Substring(0, commaIndex);\n            }\n\n            if (!File.Exists(filePath))\n                return null;\n            using (Icon sysicon = Icon.ExtractAssociatedIcon(filePath))\n            {\n                return sysicon == null\n                    ? null\n                    : Imaging.CreateBitmapSourceFromHIcon(sysicon.Handle, Int32Rect.Empty,\n                        BitmapSizeOptions.FromEmptyOptions());\n            }\n        }\n\n        internal static bool ServiceRestarter(string name, bool isStart)\n        {\n            using (ServiceController service = new ServiceController(name))\n            {\n                try\n                {\n                    if (service.Status.Equals(ServiceControllerStatus.Running) ||\n                        service.Status.Equals(ServiceControllerStatus.StartPending))\n                    {\n                        service.Stop();\n                        service.WaitForStatus(ServiceControllerStatus.Stopped, TimeSpan.FromSeconds(10));\n                        if (!service.Status.Equals(ServiceControllerStatus.Stopped) &&\n                            !service.Status.Equals(ServiceControllerStatus.StopPending))\n                        {\n                            MessageBox.Show($\"Service: {service.DisplayName} can\\'t be stopped.\");\n                            return false;\n                        }\n                    }\n\n                    if (isStart)\n                    {\n                        service.Start();\n                        service.WaitForStatus(ServiceControllerStatus.Running, TimeSpan.FromSeconds(10));\n                        if (!service.Status.Equals(ServiceControllerStatus.Running) &&\n                            !service.Status.Equals(ServiceControllerStatus.StartPending))\n                        {\n                            MessageBox.Show($\"Service: {service.DisplayName} can\\'t be started.\");\n                            return false;\n                        }\n                    }\n\n                    return true;\n                }\n                catch\n                {\n                    //ignored\n                }\n            }\n\n            return false;\n        }\n\n        internal static void ServiceStartType(string serviceName, string startType, string delayed = null)\n        {\n            try\n            {\n                using (RegistryKey servK =\n                    Registry.LocalMachine.OpenSubKey(@\"SYSTEM\\CurrentControlSet\\Services\\\" + serviceName, true))\n                {\n                    if (startType != null)\n                        servK?.SetValue(\"Start\", startType, RegistryValueKind.DWord);\n                    if (delayed != null)\n                        servK?.SetValue(\"DelayedAutostart\", delayed, RegistryValueKind.DWord);\n                }\n            }\n            catch\n            {\n                //ignored\n            }\n        }\n\n        internal static void ShowSnackBar(Snackbar sender)\n        {\n            _tipCount++;\n            const string defMessage = \"Tip: You can select multiple items by holding CTRL.\";\n            if (_tipCount < 5)\n                Task.Run(() => { Thread.Sleep(100); }).ContinueWith(t => { sender.MessageQueue.Enqueue(defMessage); },\n                    TaskScheduler.FromCurrentSynchronizationContext());\n        }\n\n        internal static RegistryHive StringToRegistryHive(string hive)\n        {\n            RegistryHive converted = RegistryHive.LocalMachine;\n            if (hive == \"HKEY_CURRENT_USER\") converted = RegistryHive.CurrentUser;\n            return converted;\n        }\n\n        internal static class FitWindow\n        {\n            private static readonly double SysHeight = SystemParameters.PrimaryScreenHeight;\n            private static readonly double SysWidth = SystemParameters.PrimaryScreenWidth;\n\n            internal static void Init(double w, double h)\n            {\n                if (SysWidth > w && SysHeight > h) return;\n                Window currWin = Application.Current.Windows.OfType<Window>().Single(win => win.IsActive);\n                if (currWin != null) currWin.WindowState = WindowState.Maximized;\n            }\n        }\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Dialogs/ChromeProcessUC.xaml",
    "content": "﻿<UserControl x:Class=\"XTR_Toolbox.Dialogs.ChromeProcessUc\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n             xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n             mc:Ignorable=\"d\"\n             Foreground=\"{StaticResource MaterialDesignBody}\"\n             Background=\"{StaticResource MaterialDesignPaper}\"\n             FontFamily=\"{StaticResource MaterialDesignFont}\"\n             FontSize=\"14\" Height=\"188\" Width=\"435\">\n    <StackPanel>\n        <StackPanel Margin=\"12\">\n            <TextBlock\n                Text=\"Google Chrome is currently open, extensions can't be removed until all processes are closed.\"\n                Margin=\"0,4\" HorizontalAlignment=\"Center\" TextAlignment=\"Center\" TextWrapping=\"Wrap\" />\n            <TextBlock Text=\"SAVE YOUR WORK BEFORE CONTINUING!\" FontWeight=\"Bold\" Margin=\"0,4\"\n                       HorizontalAlignment=\"Center\" />\n            <TextBlock Text=\"Do you want to force close Chrome?\" Margin=\"0,4\" HorizontalAlignment=\"Center\" />\n        </StackPanel>\n        <Separator Background=\"{DynamicResource AccentColorBrush}\" Margin=\"5,2\" />\n        <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\" Margin=\"0,10,0,5\">\n            <Button Content=\"_Yes\" Style=\"{DynamicResource MaterialDesignFlatButton}\" IsDefault=\"True\"\n                    Command=\"mD:DialogHost.CloseDialogCommand\" CommandParameter=\"Y\" Width=\"100\" />\n            <Button Content=\"_No\" Style=\"{DynamicResource MaterialDesignFlatButton}\" IsCancel=\"True\"\n                    Command=\"mD:DialogHost.CloseDialogCommand\" CommandParameter=\"N\" Width=\"100\" />\n        </StackPanel>\n    </StackPanel>\n</UserControl>"
  },
  {
    "path": "XTR_Toolbox/Dialogs/ChromeProcessUC.xaml.cs",
    "content": "﻿namespace XTR_Toolbox.Dialogs\n{\n    public partial class ChromeProcessUc\n    {\n        public ChromeProcessUc()\n        {\n            InitializeComponent();\n        }\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Dialogs/ForceRemoveDialog.xaml",
    "content": "﻿<mah:MetroWindow x:Class=\"XTR_Toolbox.Dialogs.ForceRemoveDialog\"\n                 xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                 xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n                 xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n                 xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n                 xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n                 xmlns:mah=\"http://metro.mahapps.com/winfx/xaml/controls\"\n                 mc:Ignorable=\"d\"\n                 Title=\"Force Remove Application\" TitleCharacterCasing=\"Normal\" Height=\"500\" Width=\"500\"\n                 Foreground=\"{StaticResource MaterialDesignBody}\"\n                 Background=\"{StaticResource MaterialDesignPaper}\"\n                 FontFamily=\"{StaticResource MaterialDesignFont}\" WindowStartupLocation=\"CenterScreen\"\n                 SizeToContent=\"Width\" FontSize=\"14\" Loaded=\"Window_Loaded\"\n                 SizeChanged=\"Window_SizeChanged\">\n    <Grid>\n        <Grid.RowDefinitions>\n            <RowDefinition Height=\"60\" />\n            <RowDefinition />\n        </Grid.RowDefinitions>\n        <StackPanel>\n            <TextBlock Margin=\"0,8,0,5\" HorizontalAlignment=\"Center\"\n                       Text=\"After the application's uninstaller finishes, these items will be deleted.\" />\n            <TextBlock Margin=\"5\" HorizontalAlignment=\"Center\" Text=\"Confirm that you want to force remove.\"\n                       FontWeight=\"Bold\" />\n            <Separator Background=\"{DynamicResource AccentColorBrush}\" Margin=\"5,2\" />\n        </StackPanel>\n        <TreeView Grid.Row=\"1\">\n            <TreeViewItem x:Name=\"TvDir\" IsExpanded=\"True\" Visibility=\"Collapsed\">\n                <TreeViewItem.Header>\n                    <StackPanel Orientation=\"Horizontal\">\n                        <mD:PackIcon Kind=\"Folder\" Height=\"18\" Width=\"18\" />\n                        <TextBlock Text=\"Directories\" Margin=\"5,0,0,0\" />\n                    </StackPanel>\n                </TreeViewItem.Header>\n            </TreeViewItem>\n            <TreeViewItem x:Name=\"TvReg\" IsExpanded=\"True\" Visibility=\"Collapsed\">\n                <TreeViewItem.Header>\n                    <StackPanel Orientation=\"Horizontal\">\n                        <mD:PackIcon Kind=\"Apps\" Height=\"18\" Width=\"18\" />\n                        <TextBlock Text=\"Registry\" Margin=\"5,0,0,0\" />\n                    </StackPanel>\n                </TreeViewItem.Header>\n            </TreeViewItem>\n        </TreeView>\n        <StackPanel HorizontalAlignment=\"Right\" VerticalAlignment=\"Bottom\" Margin=\"0,0,30,30\" Grid.Row=\"1\">\n            <Button Style=\"{DynamicResource MaterialDesignFloatingActionMiniDarkButton}\"\n                    ToolTip=\"Confirm to force remove\" Margin=\"0,0,0,12\" Click=\"BtnOK_Click\">\n                <mD:PackIcon Kind=\"Check\" Width=\"24\" Height=\"24\" />\n            </Button>\n            <Button Style=\"{DynamicResource MaterialDesignFloatingActionMiniDarkButton}\"\n                    ToolTip=\"Cancel\" Click=\"BtnCancel_Click\">\n                <mD:PackIcon Kind=\"Close\" Width=\"24\" Height=\"24\" />\n            </Button>\n        </StackPanel>\n    </Grid>\n    <Window.CommandBindings>\n        <CommandBinding Command=\"Close\" Executed=\"BtnCancel_Click\" />\n    </Window.CommandBindings>\n    <Window.InputBindings>\n        <KeyBinding Command=\"Close\" Key=\"Escape\" />\n    </Window.InputBindings>\n</mah:MetroWindow>"
  },
  {
    "path": "XTR_Toolbox/Dialogs/ForceRemoveDialog.xaml.cs",
    "content": "﻿using System.Collections.Generic;\nusing System.Linq;\nusing System.Windows;\n\nnamespace XTR_Toolbox.Dialogs\n{\n    public partial class ForceRemoveDialog\n    {\n        public static bool ForceOk;\n        private readonly string[] _dirs;\n        private readonly string[] _regs;\n        private bool _sizeChanged;\n\n        public ForceRemoveDialog(IEnumerable<string> dirs, IEnumerable<string> regs)\n        {\n            InitializeComponent();\n            _dirs = dirs.ToArray();\n            _regs = regs.ToArray();\n        }\n\n        private void BtnCancel_Click(object sender, RoutedEventArgs e)\n        {\n            ForceOk = false;\n            Close();\n        }\n\n        private void BtnOK_Click(object sender, RoutedEventArgs e)\n        {\n            ForceOk = true;\n            Close();\n        }\n\n        private bool CenterOwner()\n        {\n            if (Owner == null) return true;\n            double top = Owner.Top + (Owner.Height - ActualHeight) / 2;\n            double left = Owner.Left + (Owner.Width - ActualWidth) / 2;\n            Top = top < 0 ? 0 : top;\n            Left = left < 0 ? 0 : left;\n            return true;\n        }\n\n        private void Window_Loaded(object sender, RoutedEventArgs e)\n        {\n            if (_dirs.Length != 0)\n            {\n                TvDir.ItemsSource = _dirs;\n                TvDir.Visibility = Visibility.Visible;\n            }\n\n            if (_regs.Length != 0)\n            {\n                TvReg.ItemsSource = _regs;\n                TvReg.Visibility = Visibility.Visible;\n            }\n        }\n\n        private void Window_SizeChanged(object sender, SizeChangedEventArgs e)\n        {\n            if (!_sizeChanged)\n                _sizeChanged = CenterOwner();\n        }\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Dialogs/GenYesNoUC.xaml",
    "content": "﻿<UserControl x:Class=\"XTR_Toolbox.Dialogs.GenYesNoUc\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n             xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n             mc:Ignorable=\"d\"\n             Foreground=\"{StaticResource MaterialDesignBody}\"\n             Background=\"{StaticResource MaterialDesignPaper}\"\n             FontFamily=\"{StaticResource MaterialDesignFont}\"\n             FontSize=\"14\" Width=\"435\">\n    <StackPanel>\n        <StackPanel Margin=\"12\">\n            <TextBlock x:Name=\"TbText\" Margin=\"0,4\" HorizontalAlignment=\"Center\" TextAlignment=\"Center\"\n                       TextWrapping=\"Wrap\" />\n        </StackPanel>\n        <Separator Background=\"{DynamicResource AccentColorBrush}\" Margin=\"5,2\" />\n        <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\" Margin=\"0,10,0,5\">\n            <Button Content=\"_Yes\" Style=\"{DynamicResource MaterialDesignFlatButton}\" IsDefault=\"True\"\n                    Command=\"mD:DialogHost.CloseDialogCommand\" CommandParameter=\"Y\" Width=\"100\" />\n            <Button Content=\"_No\" Style=\"{DynamicResource MaterialDesignFlatButton}\" IsCancel=\"True\"\n                    Command=\"mD:DialogHost.CloseDialogCommand\" CommandParameter=\"N\" Width=\"100\" />\n        </StackPanel>\n    </StackPanel>\n</UserControl>"
  },
  {
    "path": "XTR_Toolbox/Dialogs/GenYesNoUC.xaml.cs",
    "content": "﻿namespace XTR_Toolbox.Dialogs\n{\n    public partial class GenYesNoUc\n    {\n        public GenYesNoUc(string text)\n        {\n            InitializeComponent();\n            TbText.Text = text;\n        }\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Dialogs/QuickToolsUc.xaml",
    "content": "﻿<UserControl x:Class=\"XTR_Toolbox.Dialogs.QuickToolsUc\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n             xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n             mc:Ignorable=\"d\"\n             Foreground=\"{StaticResource MaterialDesignBody}\"\n             Background=\"{StaticResource MaterialDesignPaper}\"\n             FontFamily=\"{StaticResource MaterialDesignFont}\"\n             FontSize=\"14\">\n    <StackPanel Margin=\"12\" Orientation=\"Vertical\">\n        <StackPanel Margin=\"10,5\" HorizontalAlignment=\"Center\">\n            <Button Content=\"Rebuild Icon Cache\" Click=\"BtnIconRebuild_Click\" Margin=\"4,5\"\n                    mD:ButtonProgressAssist.Value=\"{Binding IconProgress, Mode=OneWay}\" />\n            <Button Content=\"Rebuild Font Cache\" Click=\"BtnFontRebuild_Click\" Margin=\"4,5\"\n                    mD:ButtonProgressAssist.Value=\"{Binding FontProgress, Mode=OneWay}\" />\n            <Button Content=\"Reset Event Logs\" Click=\"BtnEventsCleaner_Click\" Margin=\"4,5\" />\n        </StackPanel>\n        <Separator Background=\"{DynamicResource AccentColorBrush}\" Margin=\"5,2\" />\n        <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\" Margin=\"0,10,0,5\">\n            <Button Content=\"_Close\" Style=\"{DynamicResource MaterialDesignFlatButton}\" IsCancel=\"True\"\n                    Command=\"mD:DialogHost.CloseDialogCommand\" Width=\"100\" />\n        </StackPanel>\n    </StackPanel>\n</UserControl>"
  },
  {
    "path": "XTR_Toolbox/Dialogs/QuickToolsUc.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Runtime.CompilerServices;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing JetBrains.Annotations;\nusing XTR_Toolbox.Classes;\n\nnamespace XTR_Toolbox.Dialogs\n{\n    public partial class QuickToolsUc\n    {\n        private readonly IndicatorModel _indicatorBind = new IndicatorModel();\n\n        public QuickToolsUc()\n        {\n            InitializeComponent();\n            DataContext = _indicatorBind;\n        }\n\n        private static void FontRebuild(IProgress<int> progress)\n        {\n            int c = 0;\n            progress.Report(c += 25);\n            const string servName = \"FontCache\";\n            try\n            {\n                string env = Environment.GetFolderPath(Environment.SpecialFolder.Windows);\n                Shared.ServiceStartType(servName, \"4\");\n                Shared.ServiceRestarter(servName, false);\n                progress.Report(c += 25);\n                CustomProc.StartProc(\"cmd.exe\",\n                    @\"/C icacls \"\"%WinDir%\\ServiceProfiles\\LocalService\"\" /grant \"\"%UserName%\"\":F /C /T /Q\",\n                    ProcessWindowStyle.Hidden);\n                string font1 = Path.Combine(env, @\"System32\\FNTCACHE.DAT\");\n                progress.Report(c += 25);\n                try\n                {\n                    File.Delete(font1);\n                }\n                catch\n                {\n                    //ignored\n                }\n\n                progress.Report(c);\n\n                foreach (string f in Directory.GetFiles(\n                    Path.Combine(env, @\"ServiceProfiles\\LocalService\\AppData\\Local\\FontCache\"), \"*FontCache*\"))\n                    try\n                    {\n                        File.Delete(f);\n                    }\n                    catch\n                    {\n                        //ignored\n                    }\n            }\n            catch (Exception ex)\n            {\n                MessageBox.Show($\"Error: {ex.Message}\");\n            }\n            finally\n            {\n                Shared.ServiceStartType(servName, \"2\", \"0\");\n                Shared.ServiceRestarter(servName, true);\n                progress.Report(100);\n            }\n        }\n\n        private static void IconRebuild(IProgress<int> progress)\n        {\n            int c = 0;\n            progress.Report(c += 25);\n            try\n            {\n                string env = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);\n                if (env.Length == 0) return;\n                foreach (Process proc in Process.GetProcessesByName(\"explorer\")) proc.Kill();\n                progress.Report(c += 25);\n                try\n                {\n                    File.Delete(Path.Combine(env, \"IconCache.db\"));\n                }\n                catch\n                {\n                    //ignored\n                }\n\n                progress.Report(c += 25);\n\n                foreach (string f in Directory.GetFiles(\n                    Path.Combine(env, @\"Microsoft\\Windows\\Explorer\"), \"iconcache*\"))\n                    try\n                    {\n                        File.Delete(f);\n                    }\n                    catch\n                    {\n                        //ignored\n                    }\n\n                progress.Report(c);\n                if (Process.GetProcessesByName(\"explorer\").Length == 0) CustomProc.StartProc(\"explorer.exe\");\n            }\n            catch (Exception ex)\n            {\n                MessageBox.Show($\"Error: {ex.Message}\");\n            }\n            finally\n            {\n                progress.Report(100);\n            }\n        }\n\n        private void BtnEventsCleaner_Click(object sender, RoutedEventArgs e)\n        {\n            Button btnEvent = (Button) sender;\n            btnEvent.IsEnabled = false;\n            string batPath = Path.Combine(Path.GetTempPath(), \"Clean_EventLogs.bat\");\n            if (File.Exists(batPath))\n                File.Delete(batPath);\n            using (StreamWriter sw = File.CreateText(batPath))\n            {\n                sw.WriteLine(\"@echo off\");\n                sw.WriteLine(\"FOR /F \\\"tokens=1,2*\\\" %%V IN ('bcdedit') DO SET adminTest=%%V\");\n                sw.WriteLine(\"IF (%adminTest%)==(Access) goto noAdmin\");\n                sw.WriteLine(\"for /F \\\"tokens=*\\\" %%G in ('wevtutil.exe el') DO (call :do_clear \\\"%%G\\\")\");\n                sw.WriteLine(\"echo.\");\n                sw.WriteLine(\"echo goto theEnd\");\n                sw.WriteLine(\":do_clear\");\n                sw.WriteLine(\"echo clearing %1\");\n                sw.WriteLine(\"wevtutil.exe cl %1\");\n                sw.WriteLine(\"goto :eof\");\n                sw.WriteLine(\":noAdmin\");\n                sw.WriteLine(\"exit\");\n            }\n\n            CustomProc.StartProc(batPath, exMsg: \"There was an error clearing event logs.\\n\");\n            File.Delete(batPath);\n            btnEvent.IsEnabled = true;\n        }\n\n        private async void BtnFontRebuild_Click(object sender, RoutedEventArgs e)\n        {\n            int pb = _indicatorBind.FontProgress;\n            if (pb != 0 && pb != 100) return;\n            Progress<int> progress = new Progress<int>(s => _indicatorBind.FontProgress = s);\n            await Task.Run(() => FontRebuild(progress));\n        }\n\n        private async void BtnIconRebuild_Click(object sender, RoutedEventArgs e)\n        {\n            int pb = _indicatorBind.IconProgress;\n            if (pb != 0 && pb != 100) return;\n            Progress<int> progress = new Progress<int>(s => _indicatorBind.IconProgress = s);\n            await Task.Run(() => IconRebuild(progress));\n        }\n\n        private class IndicatorModel : INotifyPropertyChanged\n        {\n            private int _fontProgress;\n            private int _iconProgress;\n\n            public event PropertyChangedEventHandler PropertyChanged;\n\n            public int FontProgress\n            {\n                [UsedImplicitly] get => _fontProgress;\n                set => SetField(ref _fontProgress, value);\n            }\n\n            public int IconProgress\n            {\n                [UsedImplicitly] get => _iconProgress;\n                set => SetField(ref _iconProgress, value);\n            }\n\n            private void SetField<T>(ref T field, T value, [CallerMemberName] string propName = null)\n            {\n                if (EqualityComparer<T>.Default.Equals(field, value)) return;\n                field = value;\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));\n            }\n        }\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Dialogs/RemoveTelemetryUc.xaml",
    "content": "﻿<UserControl x:Class=\"XTR_Toolbox.Dialogs.RemoveTelemetryUc\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n             xmlns:materialDesign=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n             mc:Ignorable=\"d\"\n             Foreground=\"{StaticResource MaterialDesignBody}\"\n             Background=\"{StaticResource MaterialDesignPaper}\"\n             FontFamily=\"{StaticResource MaterialDesignFont}\"\n             FontSize=\"14\">\n    <StackPanel Margin=\"12\" Orientation=\"Vertical\" Width=\"400\">\n        <TextBlock x:Name=\"TbTelemetry\" Text=\"{Binding TelemetryText}\" TextWrapping=\"Wrap\"\n                   FontSize=\"14\" Margin=\"10,0\" />\n        <Separator Margin=\"0,8\" Background=\"{DynamicResource PrimaryHueMidBrush}\" />\n        <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\">\n            <Button Content=\"Yes\" Style=\"{DynamicResource MaterialDesignFlatButton}\"\n                    Command=\"materialDesign:DialogHost.CloseDialogCommand\"\n                    Width=\"100\" Click=\"BtnTelemetryYes_Click\" />\n            <Button Content=\"No\" Style=\"{DynamicResource MaterialDesignFlatButton}\" IsCancel=\"True\"\n                    IsDefault=\"True\" Command=\"materialDesign:DialogHost.CloseDialogCommand\" Width=\"100\" />\n        </StackPanel>\n    </StackPanel>\n</UserControl>"
  },
  {
    "path": "XTR_Toolbox/Dialogs/RemoveTelemetryUc.xaml.cs",
    "content": "﻿using System.ComponentModel;\nusing System.IO;\nusing System.Windows;\nusing JetBrains.Annotations;\nusing XTR_Toolbox.Classes;\n\nnamespace XTR_Toolbox.Dialogs\n{\n    public partial class RemoveTelemetryUc\n    {\n        private readonly TextModel _textBind = new TextModel();\n\n        private readonly string[] _updates =\n        {\n            \"KB2976978\",\n            \"KB3075249\",\n            \"KB3080149\",\n            \"KB3021917\",\n            \"KB3022345\",\n            \"KB3068708\",\n            \"KB3044374\",\n            \"KB3035583\",\n            \"KB2990214\",\n            \"KB2952664\",\n            \"KB3075853\",\n            \"KB3065987\",\n            \"KB3050265\",\n            \"KB3075851\",\n            \"KB2902907\"\n        };\n\n        private string _telemetryText;\n\n        public RemoveTelemetryUc()\n        {\n            InitializeComponent();\n            TelemetryDialogText();\n        }\n\n        private void BtnTelemetryYes_Click(object sender, RoutedEventArgs e)\n        {\n            string batPath = Path.Combine(Path.GetTempPath(), \"Uninstall_Telemetry_Updates.bat\");\n            if (File.Exists(batPath))\n                File.Delete(batPath);\n            using (StreamWriter sw = File.CreateText(batPath))\n            {\n                sw.WriteLine(\"@echo off\");\n                foreach (string up in _updates)\n                    sw.WriteLine(\"start /w wusa.exe /uninstall /kb:\" + up.Replace(\"KB\", \"\") + \" /quiet /norestart\");\n\n                sw.WriteLine(\"exit\");\n            }\n\n            CustomProc.StartProc(batPath, exMsg: \"There was an error uninstalling telemetry updates.\\n\");\n            File.Delete(batPath);\n        }\n\n        private void TelemetryDialogText()\n        {\n            _telemetryText =\n                \"This will remove Windows Updates related to telemetry in Windows 7 and 8.1. \\nThis has no effect on Windows 10. It's safe to run. \\n\\nUpdates to uninstall:\\n\" +\n                string.Join(\"\\n\", _updates) +\n                \"\\n\\nAre you sure you want to do this?\";\n            TbTelemetry.DataContext = _textBind;\n            _textBind.TelemetryText = _telemetryText;\n        }\n\n        private class TextModel : INotifyPropertyChanged\n        {\n            private string _telText;\n\n            public event PropertyChangedEventHandler PropertyChanged;\n\n            public string TelemetryText\n            {\n                [UsedImplicitly] get => _telText;\n\n                set\n                {\n                    if (_telText == value) return;\n                    _telText = value;\n                    NotifyPropertyChanged(nameof(TelemetryText));\n                }\n            }\n\n            private void NotifyPropertyChanged(string propName) =>\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));\n        }\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Dialogs/StartupCreateUC.xaml",
    "content": "﻿<UserControl x:Class=\"XTR_Toolbox.Dialogs.StartupCreateUc\"\n             xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n             xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n             xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n             xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n             xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n             mc:Ignorable=\"d\"\n             Foreground=\"{StaticResource MaterialDesignBody}\"\n             Background=\"{StaticResource MaterialDesignPaper}\"\n             FontFamily=\"{StaticResource MaterialDesignFont}\"\n             FontSize=\"14\">\n    <StackPanel Margin=\"12\" Orientation=\"Vertical\" Width=\"500\">\n        <StackPanel Orientation=\"Horizontal\" Margin=\"10,5\" HorizontalAlignment=\"Center\">\n            <TextBlock Text=\"Create a new startup entry for\" FontSize=\"14\" VerticalAlignment=\"Center\" />\n            <ComboBox x:Name=\"CBoxGroup\" SelectedIndex=\"0\" IsReadOnly=\"True\" Margin=\"10,0,0,0\"\n                      MinWidth=\"100\">\n                <ComboBoxItem Content=\"Current User\" />\n                <ComboBoxItem Content=\"All Users\" />\n            </ComboBox>\n        </StackPanel>\n        <TextBox x:Name=\"TbAutoPath\" mD:HintAssist.Hint=\"Path (Enclose path in quotes if with argument)\"\n                 Margin=\"0,5\"\n                 Style=\"{DynamicResource MaterialDesignFloatingHintTextBox}\"\n                 TextChanged=\"TbAutoPath_TextChanged\" />\n        <TextBox x:Name=\"TbAutoName\" mD:HintAssist.Hint=\"Entry Name (Optional)\" Margin=\"0,5\"\n                 Style=\"{DynamicResource MaterialDesignFloatingHintTextBox}\" />\n        <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\" Margin=\"0,10,0,5\">\n            <Button x:Name=\"BtnCreate\" Content=\"Create\" Style=\"{DynamicResource MaterialDesignFlatButton}\"\n                    IsDefault=\"True\" Command=\"mD:DialogHost.CloseDialogCommand\" CommandParameter=\"Y\" Width=\"100\"\n                    IsEnabled=\"False\" />\n            <Button Content=\"_Cancel\" Style=\"{DynamicResource MaterialDesignFlatButton}\" IsCancel=\"True\"\n                    Command=\"mD:DialogHost.CloseDialogCommand\" CommandParameter=\"N\" Width=\"100\" />\n        </StackPanel>\n    </StackPanel>\n</UserControl>"
  },
  {
    "path": "XTR_Toolbox/Dialogs/StartupCreateUC.xaml.cs",
    "content": "﻿using System.Windows.Controls;\n\nnamespace XTR_Toolbox.Dialogs\n{\n    public partial class StartupCreateUc\n    {\n        public StartupCreateUc()\n        {\n            InitializeComponent();\n        }\n\n        private void TbAutoPath_TextChanged(object sender, TextChangedEventArgs e) =>\n            BtnCreate.IsEnabled = ((TextBox) sender).Text.Trim().Length != 0;\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/FodyWeavers.xml",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<Weavers>  \n  <Costura IncludeDebugSymbols='false' />\n</Weavers>"
  },
  {
    "path": "XTR_Toolbox/MainWindow.xaml",
    "content": "﻿<mah:MetroWindow x:Class=\"XTR_Toolbox.MainWindow\"\n                 xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                 xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n                 xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n                 xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n                 xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n                 xmlns:mah=\"http://metro.mahapps.com/winfx/xaml/controls\"\n                 xmlns:self=\"clr-namespace:XTR_Toolbox\"\n                 GlowBrush=\"{DynamicResource AccentColorBrush}\"\n                 mc:Ignorable=\"d\"\n                 Title=\"XTR Toolbox \" TitleCharacterCasing=\"Normal\" Height=\"450\" Width=\"560\"\n                 TextElement.FontWeight=\"Medium\" BorderThickness=\"0\"\n                 FontSize=\"16\"\n                 Background=\"{DynamicResource MaterialDesignPaper}\"\n                 FontFamily=\"{StaticResource MaterialDesignFont}\"\n                 WindowStartupLocation=\"CenterScreen\" ResizeMode=\"CanMinimize\" Icon=\"XTR_Toolbox.ico\"\n                 IconScalingMode=\"NoScaleSmallerFrame\" WindowTransitionsEnabled=\"False\"\n                 ContentRendered=\"Window_ContentRendered\">\n    <mah:MetroWindow.RightWindowCommands>\n        <mah:WindowCommands>\n            <Button Command=\"self:MainCmd.Dark\" ToolTip=\"Dark Mode Toggle [Ctrl + N]\">\n                <mD:PackIcon Kind=\"WeatherNight\" Width=\"20\" Height=\"20\" Margin=\"0,0,10,0\" VerticalAlignment=\"Center\" />\n            </Button>\n        </mah:WindowCommands>\n    </mah:MetroWindow.RightWindowCommands>\n    <mD:DialogHost CloseOnClickAway=\"True\" IsTabStop=\"False\" Identifier=\"MainDialog\">\n        <Grid>\n            <Grid.RowDefinitions>\n                <RowDefinition Height=\"224*\" />\n                <RowDefinition Height=\"146*\" />\n                <RowDefinition Height=\"29\" />\n            </Grid.RowDefinitions>\n            <Grid.ColumnDefinitions>\n                <ColumnDefinition Width=\"*\" />\n                <ColumnDefinition Width=\"*\" />\n            </Grid.ColumnDefinitions>\n            <GroupBox BorderThickness=\"1\" Grid.Row=\"0\" Grid.Column=\"0\" Margin=\"10\" Padding=\"5,6\"\n                      Style=\"{DynamicResource MaterialDesignCardGroupBox}\"\n                      Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                      mD:ColorZoneAssist.Mode=\"PrimaryDark\" Grid.ColumnSpan=\"2\">\n                <GroupBox.Header>\n                    <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\">\n                        <mD:PackIcon Kind=\"Menu\" Width=\"22\" Height=\"22\" Margin=\"0,0,5,0\" />\n                        <TextBlock Text=\"Main Tools\" VerticalAlignment=\"Center\" />\n                    </StackPanel>\n                </GroupBox.Header>\n                <Grid>\n                    <Grid.ColumnDefinitions>\n                        <ColumnDefinition />\n                        <ColumnDefinition />\n                    </Grid.ColumnDefinitions>\n                    <StackPanel>\n                        <Button x:Name=\"BtnAutoruns\" Content=\"Startup Manager...\" Click=\"BtnWinOpener\" Margin=\"8,5\" />\n                        <Button x:Name=\"BtnServices\" Content=\"Services Manager...\" Click=\"BtnWinOpener\" Margin=\"8,5\" />\n                        <Button x:Name=\"BtnSoftware\" Content=\"Software Manager...\" Click=\"BtnWinOpener\" Margin=\"8,5\" />\n                        <Button x:Name=\"BtnHostsEditor\" Content=\"Hosts File Manager...\" Click=\"BtnWinOpener\"\n                                Margin=\"8,5\" />\n                    </StackPanel>\n                    <StackPanel Grid.Column=\"1\">\n                        <Button Margin=\"8,5\" Click=\"Btn_QuickTools\" Height=\"Auto\">\n                            <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\">\n                                <mD:PackIcon Kind=\"Speedometer\" Width=\"22\" Height=\"22\" Margin=\"0,0,5,0\" />\n                                <TextBlock Text=\"Quick Tools...\" VerticalAlignment=\"Center\" />\n                            </StackPanel>\n                        </Button>\n                    </StackPanel>\n                </Grid>\n            </GroupBox>\n            <GroupBox BorderThickness=\"1\" Grid.Row=\"1\" Grid.Column=\"0\" Margin=\"10\" Padding=\"5,6\"\n                      Style=\"{DynamicResource MaterialDesignCardGroupBox}\"\n                      Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                      mD:ColorZoneAssist.Mode=\"PrimaryDark\">\n                <GroupBox.Header>\n                    <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\">\n                        <mD:PackIcon Kind=\"Windows\" Width=\"22\" Height=\"22\" Margin=\"0,0,5,0\" />\n                        <TextBlock Text=\"Privacy Tools\" VerticalAlignment=\"Center\" />\n                    </StackPanel>\n                </GroupBox.Header>\n                <StackPanel>\n                    <Button x:Name=\"BtnWinApps\" Content=\"Store Apps Manager...\" Click=\"BtnWinOpener\" Margin=\"4,5\" />\n                    <Button Content=\"Remove Telemetry Updates\" Margin=\"4,5\" Click=\"Btn_Telemetry\" />\n                </StackPanel>\n            </GroupBox>\n            <GroupBox BorderThickness=\"1\" Grid.Column=\"1\" Grid.Row=\"1\" Margin=\"10\" Padding=\"5,6\"\n                      Style=\"{DynamicResource MaterialDesignCardGroupBox}\"\n                      Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                      mD:ColorZoneAssist.Mode=\"PrimaryDark\">\n                <GroupBox.Header>\n                    <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\">\n                        <mD:PackIcon Kind=\"Broom\" Width=\"22\" Height=\"22\" Margin=\"0,0,5,0\" />\n                        <TextBlock Text=\"Cleanup Tools\" VerticalAlignment=\"Center\" />\n                    </StackPanel>\n                </GroupBox.Header>\n                <StackPanel>\n                    <Button x:Name=\"BtnCleaner\" Content=\"Junk Files Cleaner...\" Click=\"BtnWinOpener\" Margin=\"4,5\" />\n                    <Button x:Name=\"BtnChrome\" Content=\"Chrome Extensions Manager...\" Click=\"BtnWinOpener\" Margin=\"4,5\" />\n                </StackPanel>\n            </GroupBox>\n            <StatusBar Background=\"{DynamicResource PrimaryHueDarkBrush}\" Grid.ColumnSpan=\"2\" Grid.Column=\"0\"\n                       Grid.Row=\"2\" FontFamily=\"{StaticResource MaterialDesignFont}\" FontSize=\"16\" Padding=\"6,0\">\n                <StatusBarItem>\n                    <Hyperlink RequestNavigate=\"Hyperlink_OnRequestNavigate\" NavigateUri=\"https://goo.gl/zEgLR6\"\n                               Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\">\n                        <InlineUIContainer>\n                            <mD:PackIcon Kind=\"Earth\" />\n                        </InlineUIContainer>\n                        <Run Text=\"https://xtrtoolbox.blogspot.com\" />\n                    </Hyperlink>\n                </StatusBarItem>\n                <StatusBarItem DockPanel.Dock=\"Right\">\n                    <TextBlock>\n                        <Hyperlink RequestNavigate=\"Hyperlink_OnRequestNavigate\"\n                                   NavigateUri=\"https://www.patreon.com/bePatron?u=4319301\"\n                                   Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\">\n                            <InlineUIContainer>\n                                <mD:PackIcon Kind=\"Gift\" />\n                            </InlineUIContainer>\n                            <Run Text=\" Become a Patron\" />\n                        </Hyperlink>\n                    </TextBlock>\n                </StatusBarItem>\n                <TextBlock DockPanel.Dock=\"Right\" />\n            </StatusBar>\n        </Grid>\n    </mD:DialogHost>\n    <Window.CommandBindings>\n        <CommandBinding Command=\"self:MainCmd.Dark\" Executed=\"DarkCmd_Executed\" />\n        <CommandBinding Command=\"Close\" Executed=\"OnCloseExecuted\" />\n    </Window.CommandBindings>\n    <Window.InputBindings>\n        <KeyBinding Command=\"Close\" Key=\"Escape\" />\n    </Window.InputBindings>\n</mah:MetroWindow>"
  },
  {
    "path": "XTR_Toolbox/MainWindow.xaml.cs",
    "content": "﻿using System;\nusing System.Diagnostics;\nusing System.Net.Http;\nusing System.Windows;\nusing System.Windows.Input;\nusing System.Windows.Navigation;\nusing MaterialDesignThemes.Wpf;\nusing XTR_Toolbox.Dialogs;\n\nnamespace XTR_Toolbox\n{\n    public partial class MainWindow\n    {\n        public const string XtrVer = \"2.1\";\n        private readonly HttpClient _cl = new HttpClient();\n\n        public MainWindow()\n        {\n            InitializeComponent();\n            Title += XtrVer;\n        }\n\n        private async void Btn_QuickTools(object sender, RoutedEventArgs e) =>\n            await DialogHost.Show(new QuickToolsUc(), \"MainDialog\");\n\n        private async void Btn_Telemetry(object sender, RoutedEventArgs e) =>\n            await DialogHost.Show(new RemoveTelemetryUc(), \"MainDialog\");\n\n        private void BtnWinOpener(object sender, RoutedEventArgs e)\n        {\n            Window w = new Window();\n            if (Equals(sender, BtnWinApps))\n                w = new Window1();\n            else if (Equals(sender, BtnAutoruns))\n                w = new Window2();\n            else if (Equals(sender, BtnServices))\n                w = new Window3();\n            else if (Equals(sender, BtnHostsEditor))\n                w = new Window4();\n            else if (Equals(sender, BtnCleaner))\n                w = new Window5();\n            else if (Equals(sender, BtnSoftware))\n                w = new Window6();\n            else if (Equals(sender, BtnChrome))\n                w = new Window7();\n            Hide();\n            w.ShowDialog();\n            Show();\n        }\n\n        private void DarkCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            PaletteHelper pH = new PaletteHelper();\n            string curPal = pH.QueryPalette().PrimarySwatch.Name;\n            if (string.Equals(curPal, \"Brown\", StringComparison.OrdinalIgnoreCase))\n            {\n                pH.ReplacePrimaryColor(\"LightGreen\");\n                pH.SetLightDark(true);\n            }\n            else\n            {\n                pH.ReplacePrimaryColor(\"Brown\");\n                pH.SetLightDark(false);\n            }\n        }\n\n        private void Hyperlink_OnRequestNavigate(object sender, RequestNavigateEventArgs e) =>\n            Process.Start(e.Uri.AbsoluteUri);\n\n        private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) => Close();\n\n        private async void UpdateCheckAsync()\n        {\n            try\n            {\n                string res =\n                    await _cl.GetStringAsync(\n                        \"https://gist.githubusercontent.com/Zeeex/33dc2b1bda3a4055a5bd293c4e425473/raw/\");\n                if (string.CompareOrdinal(XtrVer, res) < 0)\n                    Title += @\" (Latest: \" + res + @\")\";\n            }\n            catch\n            {\n                // OFFLINE\n            }\n        }\n\n        private void Window_ContentRendered(object sender, EventArgs e)\n        {\n            if (Environment.OSVersion.Version.Major <= 6 && Environment.OSVersion.Version.Minor < 2)\n                BtnWinApps.IsEnabled = false; // DISABLED FOR WIN7\n            BtnChrome.IsEnabled = Window7.ChromeExists();\n            UpdateCheckAsync();\n        }\n    }\n\n    public static class MainCmd\n    {\n        public static readonly RoutedCommand Dark = new RoutedCommand(\"Dark\",\n            typeof(MainCmd), new InputGestureCollection {new KeyGesture(Key.N, ModifierKeys.Control)});\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/Properties/AssemblyInfo.cs",
    "content": "﻿using System.Reflection;\nusing System.Runtime.InteropServices;\nusing System.Windows;\nusing XTR_Toolbox;\n\n[assembly: AssemblyTitle(\"XTR Toolbox\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"\")]\n[assembly: AssemblyProduct(\"XTR Toolbox\")]\n[assembly: AssemblyCopyright(\"\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible\n// to COM components.  If you need to access a type in this assembly from\n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n//In order to begin building localizable applications, set\n//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file\n//inside a <PropertyGroup>.  For example, if you are using US english\n//in your source files, set the <UICulture> to en-US.  Then uncomment\n//the NeutralResourceLanguage attribute below.  Update the \"en-US\" in\n//the line below to match the UICulture setting in the project file.\n\n//[assembly: NeutralResourcesLanguage(\"en-US\", UltimateResourceFallbackLocation.Satellite)]\n\n\n[assembly: ThemeInfo(\n    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located\n    //(used if a resource is not found in the page,\n    // or application resource dictionaries)\n    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located\n    //(used if a resource is not found in the page,\n    // app, or any theme specific resource dictionaries)\n)]\n[assembly: AssemblyVersion(\"1.0.\" + MainWindow.XtrVer)]\n[assembly: AssemblyFileVersion(\"1.0.\" + MainWindow.XtrVer)]"
  },
  {
    "path": "XTR_Toolbox/Properties/Resources.Designer.cs",
    "content": "﻿//------------------------------------------------------------------------------\n// <auto-generated>\n//     This code was generated by a tool.\n//     Runtime Version:4.0.30319.42000\n//\n//     Changes to this file may cause incorrect behavior and will be lost if\n//     the code is regenerated.\n// </auto-generated>\n//------------------------------------------------------------------------------\n\nusing System.CodeDom.Compiler;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.Resources;\nusing System.Runtime.CompilerServices;\n\nnamespace XTR_Toolbox.Properties {\n    /// <summary>\n    ///   A strongly-typed resource class, for looking up localized strings, etc.\n    /// </summary>\n    // This class was auto-generated by the StronglyTypedResourceBuilder\n    // class via a tool like ResGen or Visual Studio.\n    // To add or remove a member, edit your .ResX file then rerun ResGen\n    // with the /str option, or rebuild your VS project.\n    [GeneratedCode(\"System.Resources.Tools.StronglyTypedResourceBuilder\", \"15.0.0.0\")]\n    [DebuggerNonUserCode()]\n    [CompilerGenerated()]\n    internal class Resources {\n        \n        private static ResourceManager resourceMan;\n        \n        private static CultureInfo resourceCulture;\n        \n        [SuppressMessage(\"Microsoft.Performance\", \"CA1811:AvoidUncalledPrivateCode\")]\n        internal Resources() {\n        }\n        \n        /// <summary>\n        ///   Returns the cached ResourceManager instance used by this class.\n        /// </summary>\n        [EditorBrowsable(EditorBrowsableState.Advanced)]\n        internal static ResourceManager ResourceManager {\n            get {\n                if (ReferenceEquals(resourceMan, null)) {\n                    ResourceManager temp = new ResourceManager(\"XTR_Toolbox.Properties.Resources\", typeof(Resources).Assembly);\n                    resourceMan = temp;\n                }\n                return resourceMan;\n            }\n        }\n        \n        /// <summary>\n        ///   Overrides the current thread's CurrentUICulture property for all\n        ///   resource lookups using this strongly typed resource class.\n        /// </summary>\n        [EditorBrowsable(EditorBrowsableState.Advanced)]\n        internal static CultureInfo Culture {\n            get {\n                return resourceCulture;\n            }\n            set {\n                resourceCulture = value;\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "XTR_Toolbox/Properties/Resources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!-- \n    Microsoft ResX Schema \n    \n    Version 2.0\n    \n    The primary goals of this format is to allow a simple XML format \n    that is mostly human readable. The generation and parsing of the \n    various data types are done through the TypeConverter classes \n    associated with the data types.\n    \n    Example:\n    \n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n                \n    There are any number of \"resheader\" rows that contain simple \n    name/value pairs.\n    \n    Each data row contains a name, and value. The row also contains a \n    type or mimetype. Type corresponds to a .NET class that support \n    text/value conversion through the TypeConverter architecture. \n    Classes that don't support this are serialized and stored with the \n    mimetype set.\n    \n    The mimetype is used for serialized objects, and tells the \n    ResXResourceReader how to depersist the object. This is currently not \n    extensible. For a given mimetype the value must be set accordingly:\n    \n    Note - application/x-microsoft.net.object.binary.base64 is the format \n    that the ResXResourceWriter will generate, however the reader can \n    read any of the formats listed below.\n    \n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with \n            : System.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n    \n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with \n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array \n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n</root>"
  },
  {
    "path": "XTR_Toolbox/W1_WinApps.xaml",
    "content": "﻿<mah:MetroWindow x:Class=\"XTR_Toolbox.Window1\"\n                 xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                 xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n                 xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n                 xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n                 xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n                 xmlns:mah=\"http://metro.mahapps.com/winfx/xaml/controls\"\n                 xmlns:self=\"clr-namespace:XTR_Toolbox\"\n                 mc:Ignorable=\"d\"\n                 Title=\"Store Apps Manager\" TitleCharacterCasing=\"Normal\"\n                 Foreground=\"{StaticResource MaterialDesignBody}\"\n                 Background=\"{DynamicResource MaterialDesignPaper}\"\n                 FontFamily=\"{StaticResource MaterialDesignFont}\"\n                 WindowStartupLocation=\"CenterScreen\" FontSize=\"15\" WindowTransitionsEnabled=\"False\"\n                 ContentRendered=\"Window_ContentRendered\" Height=\"480\" Width=\"640\">\n    <Grid>\n        <Grid.RowDefinitions>\n            <RowDefinition Height=\"40\" />\n            <RowDefinition Height=\"1*\" />\n            <RowDefinition Height=\"55\" />\n        </Grid.RowDefinitions>\n        <DockPanel Grid.Row=\"0\" Margin=\"10,5\">\n            <mD:PackIcon Kind=\"Filter\" Opacity=\".6\" VerticalAlignment=\"Center\" Margin=\"0,0,5,0\" />\n            <TextBox x:Name=\"TbSearch\" VerticalAlignment=\"Center\"\n                     mD:HintAssist.Hint=\" Quick Name Filter\"\n                     TextChanged=\"TbSearch_TextChanged\" />\n        </DockPanel>\n        <ListBox Grid.Row=\"1\" x:Name=\"LbApps\" Margin=\"10,6,6,10\" SelectionChanged=\"AppsListBox_SelectionChanged\"\n                 Grid.IsSharedSizeScope=\"True\">\n            <ListBox.ItemTemplate>\n                <DataTemplate>\n                    <Grid>\n                        <Grid.ColumnDefinitions>\n                            <ColumnDefinition Width=\"Auto\" SharedSizeGroup=\"ColumnSize\" />\n                        </Grid.ColumnDefinitions>\n                        <CheckBox Content=\"{Binding Name}\" IsChecked=\"{Binding Checked}\"\n                                  d:DataContext=\"{d:DesignData }\" IsTabStop=\"False\" />\n                    </Grid>\n                </DataTemplate>\n            </ListBox.ItemTemplate>\n            <ListBox.ItemsPanel>\n                <ItemsPanelTemplate>\n                    <WrapPanel/>\n                </ItemsPanelTemplate>\n            </ListBox.ItemsPanel>\n        </ListBox>\n        <DockPanel Grid.Row=\"2\" Background=\"{DynamicResource PrimaryHueDarkBrush}\">\n            <DockPanel.Resources>\n                <Style TargetType=\"TextBlock\">\n                    <Setter Property=\"VerticalAlignment\" Value=\"Center\" />\n                    <Setter Property=\"Foreground\" Value=\"{DynamicResource PrimaryHueMidForegroundBrush}\" />\n                </Style>\n            </DockPanel.Resources>\n            <CheckBox Content=\"{Binding ElementName=LbApps, Path=Items.Count}\"\n                      ContentStringFormat=\"Check {0} items\" Checked=\"ChBoxAll_Checked\"\n                      Unchecked=\"ChBoxAll_Unchecked\" Margin=\"10,0\"\n                      VerticalAlignment=\"Center\" Style=\"{DynamicResource MaterialDesignUserForegroundCheckBox}\"\n                      Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\" />\n            <StackPanel x:Name=\"StackPanelBtns\" Orientation=\"Horizontal\" HorizontalAlignment=\"Right\"\n                        Margin=\"10,-15,10,10\">\n                <Button Command=\"self:WinAppsCmd.DeleteApps\"\n                        Style=\"{DynamicResource MaterialDesignFloatingActionLightButton}\"\n                        ToolTip=\"Uninstall Selected Apps [Ctrl + D]\" Margin=\"10,0,5,0\">\n                    <mD:PackIcon Kind=\"DeleteSweep\" Width=\"24\" Height=\"24\" />\n                </Button>\n                <Button Command=\"self:WinAppsCmd.ReturnApps\"\n                        Style=\"{DynamicResource MaterialDesignFloatingActionLightButton}\"\n                        ToolTip=\"Reinstall All Apps [Ctrl + R]\" Margin=\"5,0,10,0\">\n                    <mD:PackIcon Kind=\"BackupRestore\" Width=\"24\" Height=\"24\" />\n                </Button>\n            </StackPanel>\n        </DockPanel>\n    </Grid>\n    <Window.CommandBindings>\n        <CommandBinding Command=\"self:WinAppsCmd.DeleteApps\" Executed=\"DeleteAppsCmd_Executed\"\n                        CanExecute=\"UninstallCmd_CanExecute\" />\n        <CommandBinding Command=\"self:WinAppsCmd.ReturnApps\" Executed=\"RestoreAppsCmd_Executed\" />\n        <CommandBinding Command=\"Close\" Executed=\"OnCloseExecuted\" />\n    </Window.CommandBindings>\n    <Window.InputBindings>\n        <KeyBinding Command=\"Close\" Key=\"Escape\" />\n    </Window.InputBindings>\n</mah:MetroWindow>"
  },
  {
    "path": "XTR_Toolbox/W1_WinApps.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Threading;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Input;\nusing Windows.ApplicationModel;\nusing Windows.Foundation;\nusing Windows.Management.Deployment;\nusing JetBrains.Annotations;\nusing XTR_Toolbox.Classes;\n\nnamespace XTR_Toolbox\n{\n    public partial class Window1\n    {\n        private static readonly PackageManager PacManager = new PackageManager();\n        private ObservableCollection<AppsModel> _appsModelList = new ObservableCollection<AppsModel>();\n\n        public Window1()\n        {\n            InitializeComponent();\n        }\n\n        private static IEnumerable<AppsModel> GetValidApps()\n        {\n            List<AppsModel> apps = new List<AppsModel>();\n            foreach (Package p in PacManager.FindPackagesForUser(\"\"))\n                try\n                {\n                    if (p.IsFramework || !p.InstalledLocation.Path.Contains(@\"\\WindowsApps\\\")) continue;\n                    string appName = PrettyName(p.Id.Name);\n                    string appScriptName = p.Id.FullName;\n                    apps.Add(new AppsModel {Name = appName, ScriptName = appScriptName});\n                }\n                catch (FileNotFoundException)\n                {\n                }\n\n            return apps;\n        }\n\n        private static string PrettyName(string p)\n        {\n            const string ms = \"Microsoft.\";\n            p = p.Substring(p.IndexOf(ms, StringComparison.OrdinalIgnoreCase) + ms.Length - 1).Replace(\".\", \"\");\n            return string.Concat(p.Select((x, i) =>\n                i > 1 && i < p.Length - 1 && (!char.IsLower(x) && char.IsLower(p[i - 1]) ||\n                                              !char.IsLower(x) && char.IsLower(p[i + 1]))\n                    ? $\" {x}\"\n                    : x.ToString()));\n        }\n\n        private void AppsListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)\n        {\n            if (e.RemovedItems.Count != 0 || e.AddedItems.Count == 0) return;\n            AppsModel t = (AppsModel) e.AddedItems[0];\n            t.Checked = !t.Checked;\n            LbApps.SelectedIndex = -1;\n        }\n\n        private void ChBoxAll_Checked(object sender, RoutedEventArgs e)\n        {\n            foreach (AppsModel t in _appsModelList)\n                t.Checked = true;\n        }\n\n        private void ChBoxAll_Unchecked(object sender, RoutedEventArgs e)\n        {\n            foreach (AppsModel t in _appsModelList)\n                t.Checked = false;\n        }\n\n        private void DeleteAppsCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            StackPanelBtns.IsEnabled = false;\n            for (int index = _appsModelList.Count - 1; index >= 0; index--)\n            {\n                AppsModel t = _appsModelList[index];\n                if (!t.Checked) continue;\n                IAsyncOperationWithProgress<DeploymentResult, DeploymentProgress> depOpe =\n                    PacManager.RemovePackageAsync(t.ScriptName);\n                ManualResetEvent opCompletedEvent = new ManualResetEvent(false);\n                depOpe.Completed = (depProgress, status) => { opCompletedEvent.Set(); };\n                opCompletedEvent.WaitOne();\n                switch (depOpe.Status)\n                {\n                    case AsyncStatus.Error:\n                        MessageBox.Show($\"Error code: {depOpe.ErrorCode}\\n\" +\n                                        $\"Error text: {depOpe.GetResults().ErrorText}\");\n                        break;\n                    case AsyncStatus.Canceled:\n                        MessageBox.Show(@\"Removal canceled\");\n                        break;\n                    case AsyncStatus.Completed:\n                    case AsyncStatus.Started:\n                        _appsModelList.Remove(t);\n                        break;\n                    default:\n                        MessageBox.Show($\"{t.Name} removal failed\");\n                        break;\n                }\n            }\n\n            StackPanelBtns.IsEnabled = true;\n        }\n\n        private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) => Close();\n\n        private void RestoreAppsCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            StackPanelBtns.IsEnabled = false;\n            string psPath = Path.Combine(Path.GetTempPath(), \"Win_Apps_Worker.ps1\");\n            try\n            {\n                using (StreamWriter fText = File.CreateText(psPath))\n                {\n                    string restoreApps =\n                        $@\"Get-AppXPackage -AllUsers | Foreach {{Add-AppxPackage -DisableDevelopmentMode -Register \"\"$($_.InstallLocation)\\AppXManifest.xml\"\"}}\";\n                    fText.WriteLine(restoreApps);\n                }\n\n                CustomProc.StartProc(\"powershell.exe\", \"\\\"{ Set-ExecutionPolicy Bypass }; clear; & '\" + psPath + \"'\\\"\");\n                File.Delete(psPath);\n            }\n            finally\n            {\n                StackPanelBtns.IsEnabled = true;\n            }\n        }\n\n        private void TbSearch_TextChanged(object sender, TextChangedEventArgs e) =>\n            CollectionViewSource.GetDefaultView(LbApps.ItemsSource).Refresh();\n\n        private void UninstallCmd_CanExecute(object sender, CanExecuteRoutedEventArgs e) =>\n            e.CanExecute = LbApps.Items.Cast<AppsModel>().Any(item => item.Checked);\n\n        private bool UserFilter(object item)\n        {\n            if (TbSearch.Text.Length == 0) return true;\n            return ((AppsModel) item).Name.IndexOf(TbSearch.Text, StringComparison.OrdinalIgnoreCase) >= 0;\n        }\n\n        private void Window_ContentRendered(object sender, EventArgs e)\n        {\n            Shared.FitWindow.Init(Width, Height);\n            _appsModelList = new ObservableCollection<AppsModel>(GetValidApps());\n            LbApps.ItemsSource = _appsModelList;\n            CollectionView view = (CollectionView) CollectionViewSource.GetDefaultView(LbApps.ItemsSource);\n            view.SortDescriptions.Add(new SortDescription(\"Name\", ListSortDirection.Ascending));\n            view.Filter = UserFilter;\n        }\n\n        private class AppsModel : INotifyPropertyChanged\n        {\n            private bool _checked;\n\n            public event PropertyChangedEventHandler PropertyChanged;\n\n            public bool Checked\n            {\n                [UsedImplicitly] get => _checked;\n                set => SetField(ref _checked, value);\n            }\n\n            public string Name { [UsedImplicitly] get; set; }\n            public string ScriptName { [UsedImplicitly] get; set; }\n\n            private void SetField(ref bool field, bool value, [CallerMemberName] string propName = null)\n            {\n                if (field == value) return;\n                field = value;\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));\n            }\n        }\n    }\n\n    public static class WinAppsCmd\n    {\n        public static readonly RoutedCommand DeleteApps = new RoutedCommand(\"DelApps\",\n            typeof(WinAppsCmd), new InputGestureCollection {new KeyGesture(Key.D, ModifierKeys.Control)});\n\n        public static readonly RoutedCommand ReturnApps = new RoutedCommand(\"RepApps\",\n            typeof(WinAppsCmd), new InputGestureCollection {new KeyGesture(Key.R, ModifierKeys.Control)});\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/W2_Autoruns.xaml",
    "content": "﻿<mah:MetroWindow x:Class=\"XTR_Toolbox.Window2\"\n                 xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                 xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n                 xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n                 xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n                 xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n                 xmlns:mah=\"http://metro.mahapps.com/winfx/xaml/controls\"\n                 xmlns:self=\"clr-namespace:XTR_Toolbox\"\n                 xmlns:classes=\"clr-namespace:XTR_Toolbox.Classes\"\n                 mc:Ignorable=\"d\"\n                 Title=\"Startup Manager\" TitleCharacterCasing=\"Normal\" Height=\"600\" Width=\"800\"\n                 Foreground=\"{StaticResource MaterialDesignBody}\"\n                 Background=\"{DynamicResource MaterialDesignPaper}\"\n                 FontFamily=\"{StaticResource MaterialDesignFont}\"\n                 WindowStartupLocation=\"CenterScreen\" FontSize=\"14\" WindowTransitionsEnabled=\"False\"\n                 ContentRendered=\"Window_ContentRendered\">\n    <mD:DialogHost CloseOnClickAway=\"True\" IsTabStop=\"False\" Identifier=\"RootDialog\">\n        <Grid>\n            <Grid.RowDefinitions>\n                <RowDefinition />\n                <RowDefinition Height=\"29\" />\n            </Grid.RowDefinitions>\n            <ListView x:Name=\"LvAutoruns\" FontSize=\"14\" mD:ListViewAssist.ListViewItemPadding=\"7\"\n                      mD:DataGridAssist.ColumnHeaderPadding=\"7,4\">\n                <ListView.ContextMenu>\n                    <ContextMenu>\n                        <MenuItem Command=\"self:StartupCmd.Enable\" Icon=\"{mD:PackIcon Check}\" />\n                        <MenuItem Command=\"self:StartupCmd.Disable\" Icon=\"{mD:PackIcon BlockHelper}\" />\n                        <Separator />\n                        <MenuItem Command=\"self:StartupCmd.Dir\" Icon=\"{mD:PackIcon Folder}\" />\n                        <Separator />\n                        <MenuItem Command=\"self:StartupCmd.Refresh\" Icon=\"{mD:PackIcon Refresh}\" />\n                        <Separator />\n                        <MenuItem Command=\"self:StartupCmd.Clip\" Icon=\"{mD:PackIcon ClipboardOutline}\" />\n                        <Separator />\n                        <MenuItem Command=\"self:StartupCmd.Delete\" Icon=\"{mD:PackIcon Delete}\" />\n                    </ContextMenu>\n                </ListView.ContextMenu>\n                <ListView.GroupStyle>\n                    <GroupStyle>\n                        <GroupStyle.HeaderTemplate>\n                            <DataTemplate>\n                                <TextBlock Text=\"{Binding Name,StringFormat='  {0}'}\" FontWeight=\"Bold\"\n                                           FontSize=\"14\"\n                                           d:DataContext=\"{d:DesignData }\" Margin=\"0,3\" />\n                            </DataTemplate>\n                        </GroupStyle.HeaderTemplate>\n                    </GroupStyle>\n                </ListView.GroupStyle>\n                <ListView.View>\n                    <GridView AllowsColumnReorder=\"False\">\n                        <GridViewColumn>\n                            <GridViewColumn.CellTemplate>\n                                <DataTemplate>\n                                    <DataTemplate.Resources>\n                                        <classes:StringVisibilityConverter x:Key=\"StringVisConverter\" />\n                                    </DataTemplate.Resources>\n                                    <StackPanel Orientation=\"Horizontal\" d:DataContext=\"{d:DesignData}\">\n                                        <CheckBox IsChecked=\"{Binding Enabled}\"\n                                                  Visibility=\"{Binding Path ,Converter={StaticResource StringVisConverter}}\"\n                                                  d:DataContext=\"{d:DesignData }\" IsTabStop=\"False\"\n                                                  IsHitTestVisible=\"False\" Margin=\"0,0,7,0\" />\n                                        <Image Source=\"{Binding Icon}\" Height=\"18\" Margin=\"0,0,7,0\" />\n                                        <TextBlock Text=\"{Binding Name}\" />\n                                    </StackPanel>\n                                </DataTemplate>\n                            </GridViewColumn.CellTemplate>\n                            <GridViewColumnHeader Tag=\"Name\" Click=\"LvUsersColumnHeader_Click\" Content=\"Name\" />\n                        </GridViewColumn>\n                        <GridViewColumn DisplayMemberBinding=\"{Binding Path}\">\n                            <GridViewColumnHeader Tag=\"Path\" Click=\"LvUsersColumnHeader_Click\" Content=\"Path\" />\n                        </GridViewColumn>\n                        <GridViewColumn DisplayMemberBinding=\"{Binding Args}\">\n                            <GridViewColumnHeader Tag=\"Args\" Click=\"LvUsersColumnHeader_Click\" Content=\"Arguments\" />\n                        </GridViewColumn>\n                    </GridView>\n                </ListView.View>\n            </ListView>\n            <mD:Snackbar MessageQueue=\"{mD:MessageQueue}\" x:Name=\"MainSnackbar\" IsTabStop=\"False\" Grid.Row=\"0\" />\n            <mD:DrawerHost Grid.Row=\"0\">\n                <mD:DrawerHost.RightDrawerContent>\n                    <ListBox x:Name=\"LbHistory\" Margin=\"6\" Width=\"350\">\n                        <ListBox.ItemTemplate>\n                            <DataTemplate>\n                                <TextBlock Text=\"{Binding History, Mode=OneWay}\" d:DataContext=\"{d:DesignData }\"\n                                           TextWrapping=\"Wrap\" />\n                            </DataTemplate>\n                        </ListBox.ItemTemplate>\n                    </ListBox>\n                </mD:DrawerHost.RightDrawerContent>\n                <StackPanel HorizontalAlignment=\"Right\" VerticalAlignment=\"Bottom\" Margin=\"0,0,25,20\">\n                    <Button Command=\"{x:Static mD:DrawerHost.OpenDrawerCommand}\"\n                            CommandParameter=\"{x:Static Dock.Right}\"\n                            Style=\"{DynamicResource MaterialDesignFloatingActionButton}\"\n                            ToolTip=\"View Log History\" Margin=\"8\">\n                        <mD:PackIcon Kind=\"NoteText\" Width=\"24\" Height=\"24\" />\n                    </Button>\n                    <Button Command=\"self:StartupCmd.Create\"\n                            Style=\"{DynamicResource MaterialDesignFloatingActionButton}\"\n                            ToolTip=\"Create a new startup entry [Ctrl + N]\" Margin=\"8\">\n                        <mD:PackIcon Kind=\"Plus\" Width=\"24\" Height=\"24\" />\n                    </Button>\n                </StackPanel>\n            </mD:DrawerHost>\n            <StatusBar Background=\"{DynamicResource PrimaryHueDarkBrush}\" Grid.Row=\"1\"\n                       Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                       FontFamily=\"{StaticResource MaterialDesignFont}\" FontSize=\"16\">\n                <TextBlock Text=\"{Binding ElementName=LvAutoruns, Path=Items.Count, StringFormat='Total:  {0}'}\"\n                           Margin=\"5,0,0,0\" />\n                <TextBlock Text=\"Enabled:\" Margin=\"50,0,0,0\" />\n                <TextBlock x:Name=\"TbEnabledNum\" Margin=\"5,0,0,0\" />\n                <TextBlock\n                    Text=\"{Binding ElementName=LvAutoruns, Path=SelectedItems.Count, StringFormat='Selected:  {0}'}\"\n                    Margin=\"50,0,0,0\" />\n            </StatusBar>\n        </Grid>\n    </mD:DialogHost>\n    <Window.CommandBindings>\n        <CommandBinding Command=\"self:StartupCmd.Enable\" CanExecute=\"ValidItemCmd_CanExecute\"\n                        Executed=\"StateChangeCmd_Executed\" />\n        <CommandBinding Command=\"self:StartupCmd.Disable\" CanExecute=\"ValidItemCmd_CanExecute\"\n                        Executed=\"StateChangeCmd_Executed\" />\n        <CommandBinding Command=\"self:StartupCmd.Dir\" CanExecute=\"ValidItemCmd_CanExecute\"\n                        Executed=\"OpenDirCmd_Executed\" />\n        <CommandBinding Command=\"self:StartupCmd.Refresh\" Executed=\"RefreshCmd_Executed\" />\n        <CommandBinding Command=\"self:StartupCmd.Clip\" Executed=\"ClipboardCmd_Executed\" />\n        <CommandBinding Command=\"self:StartupCmd.Delete\" Executed=\"DeleteCmd_Executed\" />\n        <CommandBinding Command=\"self:StartupCmd.Create\" Executed=\"CreateCmd_Executed\" />\n        <CommandBinding Command=\"Close\" Executed=\"OnCloseExecuted\" />\n    </Window.CommandBindings>\n    <Window.InputBindings>\n        <KeyBinding Command=\"Close\" Key=\"Escape\" />\n    </Window.InputBindings>\n</mah:MetroWindow>"
  },
  {
    "path": "XTR_Toolbox/W2_Autoruns.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.ComponentModel;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Text;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media.Imaging;\nusing JetBrains.Annotations;\nusing MaterialDesignThemes.Wpf;\nusing Microsoft.Win32;\nusing XTR_Toolbox.Classes;\nusing XTR_Toolbox.Dialogs;\n\nnamespace XTR_Toolbox\n{\n    public partial class Window2\n    {\n        private const string InfoConst = @\"Software\\Microsoft\\Windows\\CurrentVersion\\Run\";\n        private const string Run32Const = @\"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved\\Run32\";\n        private const string RunConst = @\"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\StartupApproved\\Run\";\n\n        private static readonly string[] GroupName =\n            {\"All Users (x64)\", \"Current User\", \"All Users\", \"Invalid (Broken)\"};\n\n        private static readonly ObservableCollection<StartupLogModel> HistoryList =\n            new ObservableCollection<StartupLogModel>();\n\n        private static bool _enableLog;\n\n        private ObservableCollection<StartupModel> _autorunsList;\n\n        private SortAdorner _listViewSortAdorner;\n        private GridViewColumnHeader _listViewSortCol;\n\n        public Window2()\n        {\n            InitializeComponent();\n        }\n\n        private static string AddHkcu(ICollection<StartupModel> mainList)\n        {\n            try\n            {\n                RegistryKey info = Registry.CurrentUser.OpenSubKey(InfoConst);\n                RegistryKey run = Registry.CurrentUser.OpenSubKey(RunConst);\n                if (info != null && run != null)\n                    GetEntries(info, run, GroupName[1], mainList);\n                return null;\n            }\n            catch (Exception ex)\n            {\n                return ex.Message;\n            }\n        }\n\n        private static string AddHklm(ICollection<StartupModel> mainList)\n        {\n            try\n            {\n                RegistryKey runView = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);\n                RegistryKey info = Registry.LocalMachine.OpenSubKey(InfoConst);\n                RegistryKey run64 = runView.OpenSubKey(Run32Const);\n                if (info != null && run64 != null)\n                    GetEntries(info, run64, GroupName[2], mainList);\n                return null;\n            }\n            catch (Exception ex)\n            {\n                return ex.Message;\n            }\n        }\n\n        private static string AddHklm64(ICollection<StartupModel> mainList)\n        {\n            try\n            {\n                RegistryKey runView = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);\n                RegistryKey info64 = runView.OpenSubKey(InfoConst);\n                RegistryKey run64 = runView.OpenSubKey(RunConst);\n                if (info64 != null && run64 != null)\n                    GetEntries(info64, run64, GroupName[0], mainList);\n                return null;\n            }\n            catch (Exception ex)\n            {\n                return ex.Message;\n            }\n        }\n\n        private static void GetEntries(RegistryKey infoKey, RegistryKey runKey, string groupName,\n            ICollection<StartupModel> tList)\n        {\n            try\n            {\n                string[] infoValues = infoKey.GetValueNames();\n                foreach (string infoValue in infoValues)\n                foreach (string runValue in runKey.GetValueNames())\n                {\n                    if (runKey.GetValue(runValue).GetType().Name != \"Byte[]\") continue;\n                    if (infoValue == runValue)\n                    {\n                        byte[] runValueBytes = (byte[]) runKey.GetValue(runValue);\n                        string regPath = infoKey\n                            .GetValue(infoValue, string.Empty, RegistryValueOptions.DoNotExpandEnvironmentNames)\n                            .ToString();\n                        string[] pathAndArgs = regPath.TrimStart('\\\"').Split(new[] {'\\\"'}, 2);\n                        string path = pathAndArgs[0];\n                        // IMPROVE...\n                        if (path.LastIndexOf(\"%ProgramFiles%\", StringComparison.Ordinal) != -1 &&\n                            Environment.Is64BitOperatingSystem)\n                        {\n                            path = path.Substring(path.LastIndexOf(\"%\", StringComparison.Ordinal) + 1);\n                            path = Path.GetFullPath(Environment.GetEnvironmentVariable(\"ProgramW6432\") + path);\n                        }\n\n                        string filePath = Environment.ExpandEnvironmentVariables(path);\n                        tList.Add(new StartupModel\n                        {\n                            Name = runValue,\n                            Icon = Shared.PathToIcon(filePath),\n                            Path = filePath,\n                            Args = pathAndArgs.Length == 2 ? pathAndArgs[1] : string.Empty,\n                            Enabled = runValueBytes[0] == 02,\n                            Group = groupName,\n                            RunReg = runKey.ToString()\n                        });\n                    }\n\n                    else if (!infoValues.Contains(runValue))\n                    {\n                        tList.Add(new StartupModel\n                        {\n                            Name = runValue,\n                            Group = GroupName[GroupName.Length - 1],\n                            RunReg = runKey.ToString()\n                        });\n                    }\n                }\n\n                infoKey.Close();\n                runKey.Close();\n            }\n            catch (Exception ex)\n            {\n                MessageBox.Show(ex.Message);\n            }\n        }\n\n        private void ClipboardCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            StringBuilder sb = new StringBuilder();\n            int maxNameLength = (from StartupModel t in LvAutoruns.SelectedItems select t.Name.Length)\n                .Concat(new[] {0}).Max();\n            foreach (StartupModel t in LvAutoruns.SelectedItems)\n            {\n                string format = \"{0,-\" + maxNameLength + \"}  | {1,-3} | {2}\";\n                sb.AppendFormat(format, t.Name, t.Enabled, t.Path);\n                sb.AppendLine();\n            }\n\n            Clipboard.SetText(sb.ToString());\n        }\n\n        private async void CreateCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            StartupCreateUc startupCreate = new StartupCreateUc();\n            object result = await DialogHost.Show(startupCreate, \"RootDialog\");\n            if (result == null || result.ToString() != \"Y\") return;\n\n            string tbPath = startupCreate.TbAutoPath.Text;\n            string[] pathAndArgs = tbPath.TrimStart('\\\"').Split(new[] {'\\\"'}, 2);\n            string path = pathAndArgs[0];\n            if (!File.Exists(path)) return;\n            string args = pathAndArgs.Length == 2 ? pathAndArgs[1] : string.Empty;\n            string tbName = startupCreate.TbAutoName.Text;\n            if (tbName.Trim().Length == 0) tbName = Path.GetFileNameWithoutExtension(path);\n            int groupIndex = startupCreate.CBoxGroup.SelectedIndex == 0 ? 1 : 2;\n            byte[] enableBytes = {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\n            string infoKey = null, runKey = null;\n            try\n            {\n                if (groupIndex == 1)\n                {\n                    using (RegistryKey info = Registry.CurrentUser.OpenSubKey(InfoConst, true))\n                    {\n                        if (info != null)\n                        {\n                            info.SetValue(tbName, tbPath, RegistryValueKind.String);\n                            infoKey = info.ToString();\n                        }\n                    }\n\n                    using (RegistryKey run = Registry.CurrentUser.OpenSubKey(RunConst, true))\n                    {\n                        if (run != null)\n                        {\n                            run.SetValue(tbName, enableBytes, RegistryValueKind.Binary);\n                            runKey = run.ToString();\n                        }\n                    }\n                }\n                else\n                {\n                    RegistryKey runView = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);\n                    using (RegistryKey info = Registry.LocalMachine.OpenSubKey(InfoConst, true))\n                    {\n                        if (info != null)\n                        {\n                            info.SetValue(tbName, tbPath, RegistryValueKind.String);\n                            infoKey = info.ToString();\n                        }\n                    }\n\n                    using (RegistryKey run = runView.OpenSubKey(Run32Const, true))\n                    {\n                        if (run != null)\n                        {\n                            run.SetValue(tbName, enableBytes, RegistryValueKind.Binary);\n                            runKey = run.ToString();\n                        }\n                    }\n                }\n            }\n            catch (Exception ex)\n            {\n                MessageBox.Show(\"Error creating entry! \" + ex.Message);\n            }\n\n            if (infoKey == null || runKey == null) return;\n\n            _autorunsList.Add(new StartupModel\n            {\n                Name = tbName,\n                Icon = Shared.PathToIcon(path),\n                Path = path,\n                Args = args,\n                Enabled = true,\n                Group = GroupName[groupIndex],\n                RunReg = runKey\n            });\n            HistoryList.Add(\n                new StartupLogModel {History = $\"{DateTime.Now.ToShortTimeString()} - {tbName} : Created\"});\n        }\n\n        private async void DeleteCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            int selCount = LvAutoruns.SelectedItems.Count;\n            object result = await DialogHost.Show(\n                new GenYesNoUc($\"Are you sure you want to delete {selCount} items?\"), \"RootDialog\");\n            if (result == null || result.ToString() != \"Y\") return;\n            for (int index = selCount - 1; index >= 0; index--)\n                try\n                {\n                    StartupModel itemToDelete = (StartupModel) LvAutoruns.SelectedItems[index];\n                    string deleteName = itemToDelete.Name;\n                    if (string.IsNullOrEmpty(deleteName)) continue;\n                    string itemGroup = itemToDelete.Group;\n                    string runRegPath = itemToDelete.RunReg.Split(new[] {'\\\\'}, 2)[1];\n                    RegistryKey infoKey, runKey;\n                    using (RegistryKey reg64 =\n                        RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64))\n                    {\n                        if (itemGroup == GroupName[0])\n                        {\n                            infoKey = runKey = reg64;\n                        }\n                        else if (itemGroup == GroupName[1])\n                        {\n                            infoKey = runKey = Registry.CurrentUser;\n                        }\n                        else if (itemGroup == GroupName[2])\n                        {\n                            infoKey = Registry.LocalMachine;\n                            runKey = reg64;\n                        }\n                        else if (itemGroup == GroupName[GroupName.Length - 1])\n                        {\n                            reg64.OpenSubKey(runRegPath, true)?.DeleteValue(itemToDelete.Name, false);\n                            Registry.CurrentUser.OpenSubKey(runRegPath, true)?.DeleteValue(itemToDelete.Name, false);\n                            reg64.Close();\n                            _autorunsList.Remove(itemToDelete);\n                            HistoryList.Add(\n                                new StartupLogModel\n                                {\n                                    History = $\"{DateTime.Now.ToShortTimeString()} - {itemToDelete.Name} : Deleted\"\n                                });\n                            continue;\n                        }\n                        else\n                        {\n                            continue;\n                        }\n                    }\n\n                    infoKey?.OpenSubKey(InfoConst, true)\n                        ?.DeleteValue(itemToDelete.Name, false);\n                    runKey?.OpenSubKey(runRegPath, true)?.DeleteValue(itemToDelete.Name, false);\n                    infoKey?.Close();\n                    runKey?.Close();\n                    _autorunsList.Remove(itemToDelete);\n                    HistoryList.Add(\n                        new StartupLogModel\n                        {\n                            History = $\"{DateTime.Now.ToShortTimeString()} - {itemToDelete.Name} : Deleted\"\n                        });\n                }\n                catch (Exception ex)\n                {\n                    MessageBox.Show(\n                        $\"Error deleting value: {((StartupModel) LvAutoruns.SelectedItems[index]).Name}\\n{ex.Message}\");\n                }\n        }\n\n        private void LvUsersColumnHeader_Click(object sender, RoutedEventArgs e)\n        {\n            GridViewColumnHeader column = sender as GridViewColumnHeader;\n            string sortBy = column?.Tag.ToString();\n            if (_listViewSortCol != null)\n            {\n                AdornerLayer.GetAdornerLayer(_listViewSortCol).Remove(_listViewSortAdorner);\n                LvAutoruns.Items.SortDescriptions.Clear();\n            }\n\n            ListSortDirection newDir = ListSortDirection.Ascending;\n            if (Equals(_listViewSortCol, column) && Equals(_listViewSortAdorner.Direction, newDir))\n                newDir = ListSortDirection.Descending;\n\n            _listViewSortCol = column;\n            _listViewSortAdorner = new SortAdorner(_listViewSortCol, newDir);\n            if (_listViewSortCol != null)\n                AdornerLayer.GetAdornerLayer(_listViewSortCol).Add(_listViewSortAdorner);\n            if (sortBy != null)\n                LvAutoruns.Items.SortDescriptions.Add(new SortDescription(sortBy, newDir));\n        }\n\n        private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) => Close();\n\n        private void OpenDirCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            try\n            {\n                foreach (StartupModel item in LvAutoruns.SelectedItems)\n                {\n                    string dirFull = Path.GetDirectoryName(item.Path);\n                    if (dirFull != null)\n                        CustomProc.StartProc(dirFull, wait: false);\n                }\n            }\n            catch\n            {\n                //ignored\n            }\n        }\n\n        private void RefreshCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            StartupScan();\n        }\n\n        private void StartupScan()\n        {\n            StringBuilder errorAll = new StringBuilder();\n            List<StartupModel> mainList = new List<StartupModel>();\n            List<string> regSector = new List<string>\n            {\n                AddHklm64(mainList),\n                AddHkcu(mainList),\n                AddHklm(mainList)\n            };\n            foreach (string error in regSector)\n                if (error != null)\n                    errorAll.AppendLine(error);\n\n            if (errorAll.Length > 0)\n                MessageBox.Show($\"Errors found - {errorAll.Length} : \\n{errorAll}\");\n\n            _autorunsList = new ObservableCollection<StartupModel>(mainList);\n            LvAutoruns.ItemsSource = _autorunsList;\n            CollectionView view = (CollectionView) CollectionViewSource.GetDefaultView(LvAutoruns.ItemsSource);\n            view.GroupDescriptions.Add(new PropertyGroupDescription(\"Group\"));\n            view.SortDescriptions.Add(new SortDescription(\"Path\", ListSortDirection.Descending));\n            UpdateEnabledCount();\n        }\n\n        private void StateChangeCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            if (!(e.Command is RoutedUICommand eCommand)) return;\n            bool isEnabled = eCommand == StartupCmd.Enable;\n            byte[] itemState = isEnabled\n                ? new byte[] {0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}\n                : new byte[] {0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};\n            foreach (StartupModel itemToSet in LvAutoruns.SelectedItems)\n                try\n                {\n                    RegistryKey runKey;\n                    string itemGroup = itemToSet.Group;\n                    if (itemGroup == GroupName[0] || itemGroup == GroupName[2])\n                        runKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);\n                    else if (itemGroup == GroupName[1])\n                        runKey = Registry.CurrentUser;\n                    else\n                        continue;\n                    runKey.OpenSubKey(itemToSet.RunReg.Split(new[] {'\\\\'}, 2)[1], true)\n                        ?.SetValue(itemToSet.Name, itemState, RegistryValueKind.Binary);\n                    runKey?.Close();\n                    itemToSet.Enabled = isEnabled;\n                }\n                catch (Exception ex)\n                {\n                    MessageBox.Show($\"Error changing value: {itemToSet.Name}\\n{ex.Message}\");\n                }\n\n            UpdateEnabledCount();\n        }\n\n        private void UpdateEnabledCount() =>\n            TbEnabledNum.Text = _autorunsList.Count(item => item.Enabled).ToString();\n\n        private void ValidItemCmd_CanExecute(object sender, CanExecuteRoutedEventArgs e) =>\n            e.CanExecute = LvAutoruns.SelectedItems.Cast<StartupModel>()\n                .All(item => item.Group != GroupName[GroupName.Length - 1]);\n\n\n        private void Window_ContentRendered(object sender, EventArgs e)\n        {\n            Shared.FitWindow.Init(Width, Height);\n            _enableLog = false;\n            StartupScan();\n            LbHistory.ItemsSource = HistoryList;\n            _enableLog = true;\n            Shared.ShowSnackBar(MainSnackbar);\n        }\n\n        private class StartupLogModel\n        {\n            public string History { [UsedImplicitly] get; set; }\n        }\n\n        private class StartupModel : INotifyPropertyChanged\n        {\n            private bool _enabled;\n\n            public event PropertyChangedEventHandler PropertyChanged;\n            public string Args { [UsedImplicitly] get; set; }\n\n            public bool Enabled\n            {\n                [UsedImplicitly] get => _enabled;\n                set\n                {\n                    if (!SetField(ref _enabled, value) || !_enableLog) return;\n                    string stat = value ? \"Enabled\" : \"Disabled\";\n                    HistoryList.Add(\n                        new StartupLogModel {History = $\"{DateTime.Now.ToShortTimeString()} - {Name} : {stat}\"});\n                }\n            }\n\n            public string Group { [UsedImplicitly] get; set; }\n            public BitmapSource Icon { [UsedImplicitly] get; set; }\n            public string Name { [UsedImplicitly] get; set; }\n            public string Path { [UsedImplicitly] get; set; }\n            public string RunReg { [UsedImplicitly] get; set; }\n\n            private bool SetField(ref bool field, bool value, [CallerMemberName] string propName = null)\n            {\n                if (field == value) return false;\n                field = value;\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));\n                return true;\n            }\n        }\n    }\n\n    public static class StartupCmd\n    {\n        public static readonly RoutedUICommand Clip = new RoutedUICommand(\"Copy to Clipboard\", \"Clip\",\n            typeof(StartupCmd), new InputGestureCollection {new KeyGesture(Key.C, ModifierKeys.Control)});\n\n        public static readonly RoutedCommand Create = new RoutedCommand(\"Create\",\n            typeof(StartupCmd), new InputGestureCollection {new KeyGesture(Key.N, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Delete = new RoutedUICommand(\"Delete\", \"Del\",\n            typeof(StartupCmd), new InputGestureCollection {new KeyGesture(Key.Delete)});\n\n        public static readonly RoutedUICommand Dir = new RoutedUICommand(\"Open Directory\", \"Dir\",\n            typeof(StartupCmd), new InputGestureCollection {new KeyGesture(Key.O, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Disable = new RoutedUICommand(\"Disable\", \"Dis\",\n            typeof(StartupCmd), new InputGestureCollection {new KeyGesture(Key.D, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Enable = new RoutedUICommand(\"Enable\", \"En\",\n            typeof(StartupCmd), new InputGestureCollection {new KeyGesture(Key.E, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Refresh = new RoutedUICommand(\"Quick Refresh\", \"Refresh\",\n            typeof(StartupCmd), new InputGestureCollection {new KeyGesture(Key.F5)});\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/W3_Services.xaml",
    "content": "﻿<mah:MetroWindow x:Class=\"XTR_Toolbox.Window3\"\n                 xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                 xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n                 xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n                 xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n                 xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n                 xmlns:mah=\"http://metro.mahapps.com/winfx/xaml/controls\"\n                 xmlns:self=\"clr-namespace:XTR_Toolbox\"\n                 mc:Ignorable=\"d\"\n                 Title=\"Services Manager\" TitleCharacterCasing=\"Normal\" Height=\"700\" Width=\"920\"\n                 Foreground=\"{StaticResource MaterialDesignBody}\"\n                 Background=\"{DynamicResource MaterialDesignPaper}\"\n                 FontFamily=\"{StaticResource MaterialDesignFont}\"\n                 WindowStartupLocation=\"CenterScreen\" FontSize=\"14\" WindowTransitionsEnabled=\"False\"\n                 ContentRendered=\"Window_ContentRendered\">\n    <Grid>\n        <Grid.RowDefinitions>\n            <RowDefinition Height=\"40\" />\n            <RowDefinition Height=\"1*\" />\n            <RowDefinition Height=\"29\" />\n        </Grid.RowDefinitions>\n        <DockPanel Grid.Row=\"0\" Margin=\"10,5\">\n            <mD:PackIcon Kind=\"Filter\" Opacity=\".6\" VerticalAlignment=\"Center\" Margin=\"0,0,5,0\" />\n            <TextBox x:Name=\"TbSearch\" VerticalAlignment=\"Center\"\n                     mD:HintAssist.Hint=\" Quick Name Filter\"\n                     TextChanged=\"TbSearch_TextChanged\" />\n        </DockPanel>\n        <ListView x:Name=\"LvServices\" Grid.Row=\"1\" FontSize=\"14\" mD:ListViewAssist.ListViewItemPadding=\"7\"\n                  mD:DataGridAssist.ColumnHeaderPadding=\"7,4\" VirtualizingStackPanel.IsVirtualizing=\"true\">\n            <ListView.ContextMenu>\n                <ContextMenu>\n                    <MenuItem Command=\"self:ServiceCmd.Start\" />\n                    <MenuItem Command=\"self:ServiceCmd.Stop\" />\n                    <Separator />\n                    <MenuItem Command=\"self:ServiceCmd.Disable\" />\n                    <MenuItem Command=\"self:ServiceCmd.Manual\" />\n                    <MenuItem Command=\"self:ServiceCmd.Automatic\" />\n                    <MenuItem Command=\"self:ServiceCmd.AutoDelayed\" />\n                </ContextMenu>\n            </ListView.ContextMenu>\n            <ListView.View>\n                <GridView AllowsColumnReorder=\"False\">\n                    <GridViewColumn DisplayMemberBinding=\"{Binding Full}\" Width=\"380\">\n                        <GridViewColumnHeader Tag=\"Full\" Click=\"LvUsersColumnHeader_Click\" Content=\"Full Name\"\n                                              FontWeight=\"Bold\" />\n                    </GridViewColumn>\n                    <GridViewColumn DisplayMemberBinding=\"{Binding Name}\" Width=\"240\">\n                        <GridViewColumnHeader Tag=\"Name\" Click=\"LvUsersColumnHeader_Click\" Content=\"Service Name\" />\n                    </GridViewColumn>\n                    <GridViewColumn DisplayMemberBinding=\"{Binding Status}\">\n                        <GridViewColumnHeader Tag=\"Status\" Click=\"LvUsersColumnHeader_Click\" Content=\"Status\" />\n                    </GridViewColumn>\n                    <GridViewColumn DisplayMemberBinding=\"{Binding Startup}\" Width=\"160\">\n                        <GridViewColumnHeader Tag=\"Startup\" Click=\"LvUsersColumnHeader_Click\" Content=\"Startup Type\" />\n                    </GridViewColumn>\n                </GridView>\n            </ListView.View>\n        </ListView>\n        <mD:DrawerHost Grid.Row=\"0\" Grid.RowSpan=\"2\">\n            <mD:DrawerHost.RightDrawerContent>\n                <ListBox x:Name=\"LbHistory\" Margin=\"6\" Width=\"350\">\n                    <ListBox.ItemTemplate>\n                        <DataTemplate>\n                            <TextBlock Text=\"{Binding History, Mode=OneWay}\" d:DataContext=\"{d:DesignData }\"\n                                       TextWrapping=\"Wrap\" />\n                        </DataTemplate>\n                    </ListBox.ItemTemplate>\n                </ListBox>\n            </mD:DrawerHost.RightDrawerContent>\n            <StackPanel HorizontalAlignment=\"Right\" VerticalAlignment=\"Bottom\" Margin=\"0,0,25,20\">\n                <Button Command=\"{x:Static mD:DrawerHost.OpenDrawerCommand}\"\n                        CommandParameter=\"{x:Static Dock.Right}\"\n                        Style=\"{DynamicResource MaterialDesignFloatingActionButton}\"\n                        ToolTip=\"View Log History\" Margin=\"8\">\n                    <mD:PackIcon Kind=\"NoteText\" Width=\"24\" Height=\"24\" />\n                </Button>\n            </StackPanel>\n        </mD:DrawerHost>\n        <mD:Snackbar MessageQueue=\"{mD:MessageQueue}\" x:Name=\"MainSnackbar\" IsTabStop=\"False\" Grid.Row=\"1\" />\n        <StatusBar Background=\"{DynamicResource PrimaryHueDarkBrush}\"\n                   Grid.Column=\"0\" Grid.Row=\"2\" Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                   FontFamily=\"{StaticResource MaterialDesignFont}\" FontSize=\"16\">\n            <TextBlock Text=\"{Binding ElementName=LvServices, Path=Items.Count, StringFormat='Filtered:  {0}'}\"\n                       Margin=\"5,0,0,0\" />\n            <TextBlock Text=\"Running:\" Margin=\"50,0,0,0\" />\n            <TextBlock x:Name=\"TbRunNum\" Margin=\"5,0,0,0\" />\n            <TextBlock Text=\"{Binding ElementName=LvServices, Path=SelectedItems.Count, StringFormat='Selected:  {0}'}\"\n                       Margin=\"50,0,0,0\" />\n        </StatusBar>\n    </Grid>\n    <Window.CommandBindings>\n        <CommandBinding Command=\"self:ServiceCmd.Start\" Executed=\"ServiceChange_Executed\"\n                        CanExecute=\"ServiceStart_CanExecute\" />\n        <CommandBinding Command=\"self:ServiceCmd.Stop\" Executed=\"ServiceChange_Executed\"\n                        CanExecute=\"ServiceStop_CanExecute\" />\n        <CommandBinding Command=\"self:ServiceCmd.Disable\" Executed=\"ServiceChange_Executed\" />\n        <CommandBinding Command=\"self:ServiceCmd.Manual\" Executed=\"ServiceChange_Executed\" />\n        <CommandBinding Command=\"self:ServiceCmd.Automatic\" Executed=\"ServiceChange_Executed\" />\n        <CommandBinding Command=\"self:ServiceCmd.AutoDelayed\" Executed=\"ServiceChange_Executed\" />\n        <CommandBinding Command=\"Close\" Executed=\"OnCloseExecuted\" />\n    </Window.CommandBindings>\n    <Window.InputBindings>\n        <KeyBinding Command=\"Close\" Key=\"Escape\" />\n    </Window.InputBindings>\n</mah:MetroWindow>"
  },
  {
    "path": "XTR_Toolbox/W3_Services.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.ComponentModel;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.ServiceProcess;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing JetBrains.Annotations;\nusing Microsoft.Win32;\nusing XTR_Toolbox.Classes;\n\nnamespace XTR_Toolbox\n{\n    public partial class Window3\n    {\n        private static readonly ObservableCollection<ServiceLogModel> HistoryList =\n            new ObservableCollection<ServiceLogModel>();\n\n        private static bool _enableLog;\n        private readonly List<ServiceModel> _servicesList = new List<ServiceModel>();\n\n        private SortAdorner _listViewSortAdorner;\n        private GridViewColumnHeader _listViewSortCol;\n\n        public Window3()\n        {\n            InitializeComponent();\n        }\n\n        private static string GetStartType(ServiceController service)\n        {\n            string startType = service.StartType.ToString();\n            if (startType != \"Automatic\") return startType;\n            using (RegistryKey delayedValue =\n                Registry.LocalMachine.OpenSubKey(@\"SYSTEM\\CurrentControlSet\\services\\\" + service.ServiceName))\n            {\n                string dAuto = delayedValue?.GetValue(\"DelayedAutostart\", \"\").ToString();\n                if (dAuto == \"1\")\n                    startType += \" (Delayed)\";\n            }\n\n            return startType;\n        }\n\n        private void LvUsersColumnHeader_Click(object sender, RoutedEventArgs e)\n        {\n            GridViewColumnHeader column = sender as GridViewColumnHeader;\n            string sortBy = column?.Tag.ToString();\n            if (_listViewSortCol != null)\n            {\n                AdornerLayer.GetAdornerLayer(_listViewSortCol).Remove(_listViewSortAdorner);\n                LvServices.Items.SortDescriptions.Clear();\n            }\n\n            ListSortDirection newDir = ListSortDirection.Ascending;\n            if (Equals(_listViewSortCol, column) && Equals(_listViewSortAdorner.Direction, newDir))\n                newDir = ListSortDirection.Descending;\n\n            _listViewSortCol = column;\n            _listViewSortAdorner = new SortAdorner(_listViewSortCol, newDir);\n            if (_listViewSortCol != null) AdornerLayer.GetAdornerLayer(_listViewSortCol).Add(_listViewSortAdorner);\n            if (sortBy != null) LvServices.Items.SortDescriptions.Add(new SortDescription(sortBy, newDir));\n        }\n\n        private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) => Close();\n\n        private void PopulateServices()\n        {\n            ServiceController[] servicesArray = ServiceController.GetServices();\n            foreach (ServiceController service in servicesArray)\n            {\n                string[] array = new string[4];\n                try\n                {\n                    array[0] = service.ServiceName;\n                    array[1] = service.DisplayName;\n                    array[2] = service.Status.Equals(ServiceControllerStatus.Stopped) ? \"\" : service.Status.ToString();\n                    array[3] = GetStartType(service);\n                    _servicesList.Add(new ServiceModel\n                    {\n                        Name = array[0],\n                        Full = array[1],\n                        Status = array[2],\n                        Startup = array[3]\n                    });\n                }\n                catch\n                {\n                    // ignored\n                }\n            }\n        }\n\n        private void ServiceChange_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            if (!(e.Command is RoutedUICommand eCommand)) return;\n            foreach (ServiceModel item in LvServices.SelectedItems)\n            {\n                string serviceName = item.Name;\n                using (ServiceController service = new ServiceController(serviceName))\n                {\n                    if (eCommand == ServiceCmd.Start)\n                    {\n                        if (!Shared.ServiceRestarter(serviceName, true)) return;\n                        UpdateRunningCount();\n                    }\n                    else if (eCommand == ServiceCmd.Stop)\n                    {\n                        if (!Shared.ServiceRestarter(serviceName, false)) return;\n                        UpdateRunningCount();\n                    }\n                    else\n                    {\n                        string startType = null, delayed = null;\n                        if (eCommand == ServiceCmd.Disable)\n                        {\n                            startType = \"4\";\n                        }\n                        else if (eCommand == ServiceCmd.Manual)\n                        {\n                            startType = \"3\";\n                        }\n                        else if (eCommand == ServiceCmd.Automatic)\n                        {\n                            startType = \"2\";\n                            delayed = \"0\";\n                        }\n                        else if (eCommand == ServiceCmd.AutoDelayed)\n                        {\n                            startType = \"2\";\n                            delayed = \"1\";\n                        }\n\n                        Shared.ServiceStartType(serviceName, startType, delayed);\n                    }\n\n                    item.Status = service.Status.Equals(ServiceControllerStatus.Stopped)\n                        ? \"\"\n                        : service.Status.ToString();\n                    item.Startup = GetStartType(service);\n                }\n            }\n        }\n\n        private void ServiceStart_CanExecute(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute =\n            LvServices.SelectedItems.Cast<ServiceModel>()\n                .All(item => item.Status != ServiceControllerStatus.Running.ToString());\n\n        private void ServiceStop_CanExecute(object sender, CanExecuteRoutedEventArgs e) => e.CanExecute =\n            LvServices.SelectedItems.Cast<ServiceModel>().All(item => item.Status != \"\");\n\n        private void TbSearch_TextChanged(object sender, TextChangedEventArgs e) =>\n            CollectionViewSource.GetDefaultView(LvServices.ItemsSource).Refresh();\n\n        private void UpdateRunningCount() => TbRunNum.Text =\n            _servicesList.Count(run => run.Status == ServiceControllerStatus.Running.ToString()).ToString();\n\n        private bool UserFilter(object item)\n        {\n            if (TbSearch.Text.Length == 0) return true;\n            return ((ServiceModel) item).Full.IndexOf(TbSearch.Text, StringComparison.OrdinalIgnoreCase) >= 0;\n        }\n\n        private void Window_ContentRendered(object sender, EventArgs e)\n        {\n            Shared.FitWindow.Init(Width, Height);\n            _enableLog = false;\n            PopulateServices();\n            UpdateRunningCount();\n            LvServices.ItemsSource = _servicesList;\n            CollectionView view = (CollectionView) CollectionViewSource.GetDefaultView(LvServices.ItemsSource);\n            view.SortDescriptions.Add(new SortDescription(\"Full\", ListSortDirection.Ascending));\n            view.Filter = UserFilter;\n            TbSearch.Focus();\n            LbHistory.ItemsSource = HistoryList;\n            _enableLog = true;\n            Shared.ShowSnackBar(MainSnackbar);\n        }\n\n        private class ServiceLogModel\n        {\n            public string History { [UsedImplicitly] get; set; }\n        }\n\n        private class ServiceModel : INotifyPropertyChanged\n        {\n            private string _startup;\n            private string _status;\n            public event PropertyChangedEventHandler PropertyChanged;\n            public string Full { [UsedImplicitly] get; set; }\n            public string Name { [UsedImplicitly] get; set; }\n\n            public string Startup\n            {\n                [UsedImplicitly] get => _startup;\n                set\n                {\n                    if (!SetField(ref _startup, value) || !_enableLog) return;\n                    HistoryList.Add(\n                        new ServiceLogModel {History = $\"{DateTime.Now.ToShortTimeString()} - {Name} : {value}\"});\n                }\n            }\n\n            public string Status\n            {\n                [UsedImplicitly] get => _status;\n                set\n                {\n                    if (!SetField(ref _status, value) || !_enableLog) return;\n                    if (value != ServiceControllerStatus.Running.ToString())\n                        value = \"Stopped\";\n                    HistoryList.Add(\n                        new ServiceLogModel {History = $\"{DateTime.Now.ToShortTimeString()} - {Name} : {value}\"});\n                }\n            }\n\n            private bool SetField<T>(ref T field, T value, [CallerMemberName] string propName = null)\n            {\n                if (EqualityComparer<T>.Default.Equals(field, value)) return false;\n                field = value;\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));\n                return true;\n            }\n        }\n    }\n\n    public static class ServiceCmd\n    {\n        public static readonly RoutedUICommand AutoDelayed = new RoutedUICommand(\"Auto (Delayed)\", \"AutoDel\",\n            typeof(ServiceCmd), new InputGestureCollection {new KeyGesture(Key.D4, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Automatic = new RoutedUICommand(\"Automatic\", \"Auto\",\n            typeof(ServiceCmd), new InputGestureCollection {new KeyGesture(Key.D3, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Disable = new RoutedUICommand(\"Disable\", \"Dis\",\n            typeof(ServiceCmd), new InputGestureCollection {new KeyGesture(Key.D1, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Manual = new RoutedUICommand(\"Manual\", \"Man\",\n            typeof(ServiceCmd), new InputGestureCollection {new KeyGesture(Key.D2, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Start = new RoutedUICommand(\"Start Service\", \"Start\",\n            typeof(ServiceCmd), new InputGestureCollection {new KeyGesture(Key.S, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Stop = new RoutedUICommand(\"Stop Service\", \"Stop\",\n            typeof(ServiceCmd), new InputGestureCollection {new KeyGesture(Key.D, ModifierKeys.Control)});\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/W4_Hosts.xaml",
    "content": "﻿<mah:MetroWindow x:Class=\"XTR_Toolbox.Window4\"\n                 xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                 xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n                 xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n                 xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n                 xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n                 xmlns:mah=\"http://metro.mahapps.com/winfx/xaml/controls\"\n                 mc:Ignorable=\"d\"\n                 Title=\"Hosts File Manager\" TitleCharacterCasing=\"Normal\" Height=\"630\" Width=\"750\"\n                 Foreground=\"{StaticResource MaterialDesignBody}\"\n                 Background=\"{DynamicResource MaterialDesignPaper}\"\n                 FontFamily=\"{StaticResource MaterialDesignFont}\"\n                 WindowStartupLocation=\"CenterScreen\" FontSize=\"14\" WindowTransitionsEnabled=\"False\"\n                 ContentRendered=\"Window_ContentRendered\">\n    <Grid>\n        <TextBox x:Name=\"TbHostsFile\" Foreground=\"{DynamicResource MaterialDesignLightBackground}\"\n                 Background=\"{DynamicResource MaterialDesignDarkBackground}\"\n                 SelectionBrush=\"{DynamicResource CheckmarkFill}\"\n                 FontFamily=\"Consolas\" TextWrapping=\"Wrap\" AcceptsReturn=\"True\"\n                 VerticalScrollBarVisibility=\"Auto\" VerticalContentAlignment=\"Stretch\" />\n        <StackPanel x:Name=\"StackPanelBtns\" Orientation=\"Horizontal\" HorizontalAlignment=\"Right\"\n                    VerticalAlignment=\"Bottom\" Margin=\"0,0,20,17\">\n            <Button x:Name=\"BtnSave\" Click=\"BtnHostsManage_Click\"\n                    Style=\"{DynamicResource MaterialDesignFloatingActionButton}\"\n                    ToolTip=\"Save Hosts File\"\n                    IsEnabled=\"False\" HorizontalAlignment=\"Right\" Margin=\"8\">\n                <mD:PackIcon Kind=\"ContentSave\" Width=\"24\" Height=\"24\" />\n            </Button>\n            <Button Click=\"BtnDownload_Click\"\n                    Style=\"{DynamicResource MaterialDesignFloatingActionButton}\"\n                    ToolTip=\"Download Hosts File from winhelp2002.mvps.org\"\n                    HorizontalAlignment=\"Right\" Margin=\"8\">\n                <mD:PackIcon Kind=\"CloudDownload\" Width=\"24\" Height=\"24\" />\n            </Button>\n            <Button x:Name=\"BtnReset\" Click=\"BtnHostsManage_Click\"\n                    Style=\"{DynamicResource MaterialDesignFloatingActionButton}\"\n                    ToolTip=\"Reset Rules\" HorizontalAlignment=\"Right\" Margin=\"8\">\n                <mD:PackIcon Kind=\"Replay\" Width=\"24\" Height=\"24\" />\n            </Button>\n        </StackPanel>\n    </Grid>\n    <Window.CommandBindings>\n        <CommandBinding Command=\"Close\" Executed=\"OnCloseExecuted\" />\n    </Window.CommandBindings>\n    <Window.InputBindings>\n        <KeyBinding Command=\"Close\" Key=\"Escape\" />\n    </Window.InputBindings>\n</mah:MetroWindow>"
  },
  {
    "path": "XTR_Toolbox/W4_Hosts.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Net.Http;\nusing System.Windows;\nusing System.Windows.Input;\nusing XTR_Toolbox.Classes;\n\nnamespace XTR_Toolbox\n{\n    public partial class Window4\n    {\n        private readonly string _hostsFilePath =\n            Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System), \"drivers/etc/hosts\");\n\n        public Window4()\n        {\n            InitializeComponent();\n        }\n\n        private async void BtnDownload_Click(object sender, RoutedEventArgs e)\n        {\n            StackPanelBtns.IsEnabled = false;\n            using (HttpClient client = new HttpClient())\n            {\n                string result = await client.GetStringAsync(\"http://winhelp2002.mvps.org/hosts.txt\");\n                TbHostsFile.TextChanged -= TbHostsFile_TextChanged;\n                TbHostsFile.Text = result;\n                TbHostsFile.TextChanged += TbHostsFile_TextChanged;\n                BtnHostsManage_Click(BtnSave, null);\n            }\n\n            StackPanelBtns.IsEnabled = true;\n        }\n\n        private void BtnHostsManage_Click(object sender, RoutedEventArgs e)\n        {\n            BtnSave.IsEnabled = false;\n            if (Equals(sender, BtnReset))\n            {\n                string[] lines = TbHostsFile.Text.Split('\\n');\n                List<string> comments = lines.Where(line => line.TrimStart(' ').StartsWith(\"#\")).ToList();\n                TbHostsFile.TextChanged -= TbHostsFile_TextChanged;\n                TbHostsFile.Text = string.Join(\"\\n\", comments);\n                TbHostsFile.TextChanged += TbHostsFile_TextChanged;\n            }\n\n            try\n            {\n                using (StreamWriter file = File.CreateText(_hostsFilePath))\n                {\n                    file.Write(TbHostsFile.Text);\n                }\n            }\n            catch (Exception ex)\n            {\n                MessageBox.Show(ex.Message);\n            }\n        }\n\n        private void HostsLoad()\n        {\n            try\n            {\n                if (!File.Exists(_hostsFilePath)) throw new Exception();\n                TbHostsFile.TextChanged -= TbHostsFile_TextChanged;\n                TbHostsFile.Text = File.ReadAllText(_hostsFilePath);\n                TbHostsFile.TextChanged += TbHostsFile_TextChanged;\n            }\n            catch (Exception ex)\n            {\n                MessageBox.Show(ex.Message);\n                Opacity = 0;\n                Loaded += (s, e) => Close();\n            }\n        }\n\n        private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) => Close();\n\n        private void TbHostsFile_TextChanged(object sender, EventArgs e) => BtnSave.IsEnabled = true;\n\n        private void Window_ContentRendered(object sender, EventArgs e)\n        {\n            Shared.FitWindow.Init(Width, Height);\n            HostsLoad();\n        }\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/W5_Cleanup.xaml",
    "content": "﻿<mah:MetroWindow x:Class=\"XTR_Toolbox.Window5\"\n                 xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                 xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n                 xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n                 xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n                 xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n                 xmlns:mah=\"http://metro.mahapps.com/winfx/xaml/controls\"\n                 xmlns:self=\"clr-namespace:XTR_Toolbox\"\n                 mc:Ignorable=\"d\"\n                 Title=\"Junk Files Cleaner\" TitleCharacterCasing=\"Normal\" Height=\"670\" Width=\"1140\"\n                 Foreground=\"{StaticResource MaterialDesignBody}\"\n                 Background=\"{DynamicResource MaterialDesignPaper}\"\n                 FontFamily=\"{StaticResource MaterialDesignFont}\"\n                 WindowStartupLocation=\"CenterScreen\" FontSize=\"16\" WindowTransitionsEnabled=\"False\"\n                 ContentRendered=\"Window_ContentRendered\">\n    <Grid>\n        <Grid.ColumnDefinitions>\n            <ColumnDefinition MaxWidth=\"284\" />\n            <ColumnDefinition MinWidth=\"284\" />\n        </Grid.ColumnDefinitions>\n        <mD:Card UniformCornerRadius=\"0\" VerticalAlignment=\"Stretch\" Margin=\"0,0,1,0\">\n            <Grid>\n                <Grid.RowDefinitions>\n                    <RowDefinition MinHeight=\"200\" />\n                    <RowDefinition Height=\"162\" />\n                    <RowDefinition Height=\"130\" />\n                </Grid.RowDefinitions>\n                <GroupBox Margin=\"10,5,10,8\" Padding=\"5\" mD:ColorZoneAssist.Mode=\"PrimaryDark\"\n                          Style=\"{DynamicResource MaterialDesignCardGroupBox}\" DockPanel.Dock=\"Top\">\n                    <GroupBox.Header>\n                        <CheckBox Content=\"Select All\" VerticalContentAlignment=\"Stretch\"\n                                  Style=\"{DynamicResource MaterialDesignUserForegroundCheckBox}\"\n                                  Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                                  Checked=\"CheckBoxAll_Checked\" Unchecked=\"CheckBoxAll_Unchecked\" />\n                    </GroupBox.Header>\n                    <ListBox x:Name=\"LbDir\" SelectionChanged=\"LbSidebar_SelectionChanged\">\n                        <ListBox.ItemTemplate>\n                            <DataTemplate>\n                                <CheckBox Content=\"{Binding Text}\" IsChecked=\"{Binding Checked}\"\n                                          IsEnabled=\"{Binding Enabled}\" IsTabStop=\"False\"\n                                          d:DataContext=\"{d:DesignData ''}\" FontSize=\"16\" />\n                            </DataTemplate>\n                        </ListBox.ItemTemplate>\n                        <ListBox.ItemContainerStyle>\n                            <Style TargetType=\"{x:Type ListBoxItem}\"\n                                   BasedOn=\"{StaticResource MaterialDesignListBoxItem}\">\n                                <Setter Property=\"Padding\" Value=\"8,4\" />\n                            </Style>\n                        </ListBox.ItemContainerStyle>\n                    </ListBox>\n                </GroupBox>\n                <GroupBox Grid.Row=\"1\" Margin=\"10,5,10,8\" Padding=\"2,5\" mD:ColorZoneAssist.Mode=\"PrimaryDark\"\n                          Style=\"{DynamicResource MaterialDesignCardGroupBox}\" DockPanel.Dock=\"Bottom\">\n                    <GroupBox.Header>\n                        <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\">\n                            <mD:PackIcon Kind=\"Filter\" Width=\"22\" Height=\"22\" Margin=\"0,0,5,0\"\n                                         Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\" />\n                            <TextBlock Text=\"Filter\" FontWeight=\"Bold\"\n                                       Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                                       VerticalAlignment=\"Center\" />\n                        </StackPanel>\n                    </GroupBox.Header>\n                    <StackPanel Margin=\"5,0,0,0\">\n                        <DockPanel>\n                            <TextBlock Text=\"Extension:\" VerticalAlignment=\"Center\" />\n                            <TextBox x:Name=\"TBoxTypes\" mD:HintAssist.Hint=\".tmp, *.log\" Margin=\"10,0\" />\n                        </DockPanel>\n                        <Separator Style=\"{StaticResource MaterialDesignDarkSeparator}\" Margin=\"5,0\" />\n                        <DockPanel>\n                            <TextBlock Text=\"Date:\" VerticalAlignment=\"Center\" />\n                            <DatePicker x:Name=\"DateFilter\" mD:HintAssist.Hint=\"Pick Date\" Margin=\"10,0\" />\n                        </DockPanel>\n                        <DockPanel Margin=\"0,12,0,0\">\n                            <TextBlock Text=\"Before Date\" VerticalAlignment=\"Center\" />\n                            <TextBlock Text=\"After Date\" VerticalAlignment=\"Center\" Margin=\"0,0,10,0\"\n                                       DockPanel.Dock=\"Right\" />\n                            <ToggleButton x:Name=\"TglDate\" />\n                        </DockPanel>\n                    </StackPanel>\n                </GroupBox>\n                <GroupBox Grid.Row=\"2\" Margin=\"10,5,10,8\" Padding=\"2,5\" mD:ColorZoneAssist.Mode=\"PrimaryDark\"\n                          Style=\"{DynamicResource MaterialDesignCardGroupBox}\" DockPanel.Dock=\"Bottom\">\n                    <GroupBox.Header>\n                        <StackPanel Orientation=\"Horizontal\" HorizontalAlignment=\"Center\">\n                            <mD:PackIcon Kind=\"Settings\" Width=\"22\" Height=\"22\" Margin=\"0,0,5,0\"\n                                         Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\" />\n                            <TextBlock Text=\"Advanced\" FontWeight=\"Bold\"\n                                       Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                                       VerticalAlignment=\"Center\" />\n                        </StackPanel>\n                    </GroupBox.Header>\n                    <StackPanel Margin=\"5,0,0,0\">\n                        <DockPanel>\n                            <CheckBox x:Name=\"CheckBoxGroup\" Content=\"Show Groups\" Height=\"25\" />\n                        </DockPanel>\n                        <Separator Style=\"{StaticResource MaterialDesignDarkSeparator}\" Margin=\"5,0\" />\n                        <DockPanel>\n                            <TextBlock Text=\"Scan Depth Level:\" VerticalAlignment=\"Center\" />\n                            <ComboBox x:Name=\"CbBoxLevel\" Width=\"50\" HorizontalAlignment=\"Right\" Margin=\"0,0,10,0\" />\n                        </DockPanel>\n                    </StackPanel>\n                </GroupBox>\n            </Grid>\n        </mD:Card>\n        <ListView x:Name=\"LvCleaner\" FontSize=\"14\" Margin=\"0,0,0,5\" Grid.Column=\"1\" Grid.Row=\"0\"\n                  mD:ListViewAssist.ListViewItemPadding=\"6\" mD:DataGridAssist.ColumnHeaderPadding=\"6,4\">\n            <ListView.GroupStyle>\n                <GroupStyle>\n                    <GroupStyle.ContainerStyle>\n                        <Style TargetType=\"{x:Type GroupItem}\">\n                            <Setter Property=\"Template\">\n                                <Setter.Value>\n                                    <ControlTemplate>\n                                        <Expander IsExpanded=\"True\">\n                                            <Expander.Header>\n                                                <StackPanel Orientation=\"Horizontal\">\n                                                    <TextBlock Text=\"{Binding Name}\" FontWeight=\"Bold\"\n                                                               Foreground=\"{DynamicResource PrimaryHueMidBrush}\"\n                                                               FontSize=\"16\" />\n                                                    <TextBlock\n                                                        Text=\"{Binding ItemCount, StringFormat='{}{0} item(s) found'}\"\n                                                        FontSize=\"16\" Margin=\"10,0,0,0\" />\n                                                </StackPanel>\n                                            </Expander.Header>\n                                            <ItemsPresenter />\n                                        </Expander>\n                                    </ControlTemplate>\n                                </Setter.Value>\n                            </Setter>\n                        </Style>\n                    </GroupStyle.ContainerStyle>\n                </GroupStyle>\n            </ListView.GroupStyle>\n            <ListView.View>\n                <GridView AllowsColumnReorder=\"False\">\n                    <GridViewColumn DisplayMemberBinding=\"{Binding Path}\" Width=\"490\">\n                        <GridViewColumn.Header>\n                            <GridViewColumnHeader Tag=\"Path\" Click=\"LvUsersColumnHeader_Click\">\n                                <GridViewColumnHeader.Content>\n                                    <TextBlock x:Name=\"TbHeader\">\n                                        <TextBlock.Text>\n                                            <MultiBinding StringFormat=\"File Path ({0} Files - {1} MB)\"\n                                                          Mode=\"OneWay\">\n                                                <Binding ElementName=\"LvCleaner\" Path=\"Items.Count\" />\n                                                <Binding Path=\"MaxSize\" FallbackValue=\"0\" />\n                                            </MultiBinding>\n                                        </TextBlock.Text>\n                                    </TextBlock>\n                                </GridViewColumnHeader.Content>\n                            </GridViewColumnHeader>\n                        </GridViewColumn.Header>\n                    </GridViewColumn>\n                    <GridViewColumn DisplayMemberBinding=\"{Binding Size}\">\n                        <GridViewColumnHeader Tag=\"Size\" Click=\"LvUsersColumnHeader_Click\" Content=\"File Size\" />\n                    </GridViewColumn>\n                    <GridViewColumn DisplayMemberBinding=\"{Binding Date}\">\n                        <GridViewColumnHeader Tag=\"Date\" Click=\"LvUsersColumnHeader_Click\" Content=\"Date Accessed\" />\n                    </GridViewColumn>\n                    <GridViewColumn DisplayMemberBinding=\"{Binding Extension}\">\n                        <GridViewColumnHeader Tag=\"Extension\" Click=\"LvUsersColumnHeader_Click\" Content=\"Extension\" />\n                    </GridViewColumn>\n                </GridView>\n            </ListView.View>\n        </ListView>\n        <mD:Snackbar MessageQueue=\"{mD:MessageQueue}\" x:Name=\"MainSnackbar\" IsTabStop=\"False\" Margin=\"0,0,0,5\"\n                     Grid.Column=\"1\">\n            <mD:SnackbarMessage IsTabStop=\"False\" x:Name=\"MainSnackbarMessage\" />\n        </mD:Snackbar>\n        <StackPanel x:Name=\"StackPanelBtns\" Grid.Row=\"0\" Grid.Column=\"1\" HorizontalAlignment=\"Right\"\n                    VerticalAlignment=\"Bottom\" Margin=\"0,0,30,30\">\n            <mD:Badged Badge=\"{Binding ScanTime, Mode=OneWay}\" BadgePlacementMode=\"Top\"\n                       BadgeColorZoneMode=\"PrimaryDark\">\n                <Button x:Name=\"BtnAnalyze\" Command=\"self:CleanCmd.Scan\"\n                        Style=\"{DynamicResource MaterialDesignFloatingActionLightButton}\"\n                        mD:ButtonProgressAssist.IsIndeterminate=\"{Binding ScanIndicator, Mode=OneWay}\"\n                        mD:ButtonProgressAssist.IsIndicatorVisible=\"{Binding ScanIndicator, Mode=OneWay}\"\n                        ToolTip=\"Start Scan [Ctrl + S]\" Margin=\"0,0,0,20\">\n                    <mD:PackIcon Kind=\"Magnify\" Width=\"24\" Height=\"24\" />\n                </Button>\n            </mD:Badged>\n            <mD:Badged Badge=\"{Binding ElementName=LvCleaner, Path=SelectedItems.Count}\"\n                       BadgePlacementMode=\"Top\" BadgeColorZoneMode=\"PrimaryLight\">\n                <Button Command=\"self:CleanCmd.Delete\"\n                        Style=\"{DynamicResource MaterialDesignFloatingActionDarkButton}\"\n                        mD:ButtonProgressAssist.Maximum=\"{Binding ElementName=LvCleaner, Path=SelectedItems.Count}\"\n                        mD:ButtonProgressAssist.Value=\"{Binding DeleteProgress, Mode=OneWay}\"\n                        mD:ButtonProgressAssist.IsIndicatorVisible=\"{Binding DeleteIndicator, Mode=OneWay}\"\n                        ToolTip=\"Delete Selected Files [Ctrl + DEL]\">\n                    <mD:PackIcon Kind=\"Delete\" Width=\"24\" Height=\"24\" />\n                </Button>\n            </mD:Badged>\n        </StackPanel>\n    </Grid>\n    <Window.CommandBindings>\n        <CommandBinding Command=\"self:CleanCmd.Scan\" Executed=\"ScanCmd_Executed\" CanExecute=\"ScanCmd_CanExecute\" />\n        <CommandBinding Command=\"self:CleanCmd.Delete\" Executed=\"DeleteCmd_Executed\" CanExecute=\"DeleteCmd_CanExecute\" />\n        <CommandBinding Command=\"Close\" Executed=\"OnCloseExecuted\" />\n    </Window.CommandBindings>\n    <Window.InputBindings>\n        <KeyBinding Command=\"Close\" Key=\"Escape\" />\n    </Window.InputBindings>\n</mah:MetroWindow>"
  },
  {
    "path": "XTR_Toolbox/W5_Cleanup.xaml.cs",
    "content": "﻿using System;\nusing System.Collections;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Threading.Tasks;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Threading;\nusing JetBrains.Annotations;\nusing XTR_Toolbox.Classes;\n\nnamespace XTR_Toolbox\n{\n    public partial class Window5\n    {\n        private static readonly string SteamLibraryDir = GetSteamLibraryDir();\n\n        private static bool _befDate;\n        private static string _date;\n\n        private readonly ICollection<CheckBoxModel> _dirList = new Collection<CheckBoxModel>();\n        private readonly IndicatorModel _indicatorBind = new IndicatorModel();\n        private ObservableCollection<CleanModel> _cleanList;\n        private SortAdorner _listViewSortAdorner;\n        private GridViewColumnHeader _listViewSortCol;\n        private int _scanElapsed;\n        private readonly DispatcherTimer _dispatcherTimer = new DispatcherTimer {Interval = new TimeSpan(0, 0, 1)};\n\n        public Window5()\n        {\n            InitializeComponent();\n        }\n\n        private static float AddModelToTemp(string baseDir, ICollection<CleanModel> tempList, string filePath)\n        {\n            float fileSize;\n            try\n            {\n                FileInfo fileInfo = new FileInfo(filePath);\n                fileSize = fileInfo.Length / 1024 + 1;\n                string cleanedPath = filePath.Replace(baseDir, \"\").TrimStart('\\\\');\n                tempList.Add(new CleanModel\n                {\n                    Path = cleanedPath,\n                    Size = fileSize + \" KB\",\n                    Date = fileInfo.LastAccessTime.ToString(\"yyyy-MM-dd\", CultureInfo.InvariantCulture),\n                    Extension = Path.GetExtension(cleanedPath).ToLower(),\n                    Group = baseDir\n                });\n            }\n            catch (FileNotFoundException)\n            {\n                return 0;\n            }\n\n            return fileSize;\n        }\n\n        private static void DeleteOp(IEnumerable input, ICollection<CleanModel> output, IProgress<int> progress)\n        {\n            int co = 0;\n            foreach (CleanModel item in input)\n            {\n                string combinedPath = Path.Combine(item.Group, item.Path);\n                progress.Report(++co);\n                try\n                {\n                    File.Delete(combinedPath);\n                    output.Add(item);\n                    string directoryName = Path.GetDirectoryName(combinedPath);\n                    if (directoryName != null)\n                        Directory.Delete(directoryName);\n                }\n                catch\n                {\n                    //ignored\n                }\n            }\n        }\n\n        private static void DirectorySearch(IReadOnlyCollection<string> dirs, string multiExt,\n            ICollection<CleanModel> tempList, int depth, bool isSteam, ref float maxSize)\n        {\n            if (dirs.Any())\n            {\n                ICollection<string> typeToScan = new Collection<string>();\n                if (multiExt != \"\")\n                {\n                    string[] split = multiExt.Split(new[] {','}, StringSplitOptions.RemoveEmptyEntries);\n                    foreach (string type in split)\n                    {\n                        string trimmed = type.Trim();\n                        if (trimmed.StartsWith(\"*\"))\n                            typeToScan.Add(trimmed);\n                        if (trimmed.StartsWith(\".\"))\n                            typeToScan.Add(\"*\" + trimmed);\n                    }\n                }\n                else\n                {\n                    typeToScan.Add(\"*\");\n                }\n\n                maxSize += dirs.Sum(baseDir =>\n                    GetDirectoryFilesLoop(baseDir, typeToScan, depth)\n                        .Sum(fileFull => AddModelToTemp(baseDir, tempList, fileFull) / 1024));\n            }\n\n            if (isSteam)\n                SteamLibrarySearch(SteamLibraryDir, tempList, ref maxSize);\n        }\n\n        private static IEnumerable<string> GetDirectoryFilesLoop(string root, IEnumerable<string> types, int depth)\n        {\n            List<string> foundFiles = new List<string>();\n            IEnumerable<string> typeEnum = types as string[] ?? types.ToArray();\n\n            foreach (string ext in typeEnum)\n                try\n                {\n                    if (_date.Length == 0)\n                    {\n                        foundFiles.AddRange(Directory.EnumerateFiles(root, ext));\n                    }\n                    else\n                    {\n                        ICollection<string> dateList = new Collection<string>();\n                        foreach (string item in Directory.EnumerateFiles(root, ext))\n                        {\n                            FileInfo ii = new FileInfo(item);\n                            if (_befDate)\n                            {\n                                if (ii.LastAccessTime < DateTime.Parse(_date))\n                                    dateList.Add(item);\n                            }\n                            else if (ii.LastAccessTime >= DateTime.Parse(_date))\n                            {\n                                dateList.Add(item);\n                            }\n                        }\n\n                        foundFiles.AddRange(dateList);\n                    }\n                }\n                catch (UnauthorizedAccessException)\n                {\n                }\n\n            if (depth <= 0) return foundFiles;\n            try\n            {\n                foreach (string subDir in Directory.EnumerateDirectories(root))\n                    foundFiles.AddRange(GetDirectoryFilesLoop(subDir, typeEnum, depth - 1));\n            }\n            catch (UnauthorizedAccessException)\n            {\n            }\n\n            return foundFiles;\n        }\n\n        private static string GetSteamLibraryDir()\n        {\n            string[] drives = DriveInfo.GetDrives()\n                .Where(info => info.DriveType == DriveType.Fixed).Select(info => info.Name).ToArray();\n            string[] dirs =\n            {\n                drives[1] + @\"SteamLibrary\\SteamApps\\common\",\n                drives[0] + @\"SteamLibrary\\SteamApps\\common\",\n                Path.Combine(Path.GetPathRoot(Environment.SystemDirectory), @\"Steam\\SteamApps\\common\"),\n                Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86),\n                    @\"Steam\\SteamApps\\common\")\n            };\n            foreach (string one in dirs)\n            {\n                if (!Directory.Exists(one)) continue;\n                return one;\n            }\n\n            return dirs[0];\n        }\n\n        private static void SteamLibrarySearch(string root, ICollection<CleanModel> tempList, ref float totalSize)\n        {\n            string[] patternName = {\"Redist\", \"directx\", \"setup\", \"depends\"};\n            try\n            {\n                foreach (string gameDir in Directory.EnumerateDirectories(root))\n                foreach (string pattDir in Directory.EnumerateDirectories(gameDir))\n                {\n                    if (!patternName.Any(pattDir.Contains)) continue;\n                    try\n                    {\n                        totalSize += Directory.EnumerateFiles(pattDir, \"*\", SearchOption.AllDirectories)\n                            .Sum(filePath => AddModelToTemp(root, tempList, filePath) / 1024);\n                    }\n                    catch (UnauthorizedAccessException)\n                    {\n                    }\n                }\n            }\n            catch (UnauthorizedAccessException)\n            {\n            }\n        }\n\n        private void CheckBoxAll_Checked(object sender, RoutedEventArgs e)\n        {\n            foreach (CheckBoxModel t in _dirList)\n                if (t.Enabled)\n                    t.Checked = true;\n        }\n\n        private void CheckBoxAll_Unchecked(object sender, RoutedEventArgs e)\n        {\n            foreach (CheckBoxModel t in _dirList)\n                t.Checked = false;\n        }\n\n        private void DeleteCmd_CanExecute(object sender, CanExecuteRoutedEventArgs e) =>\n            e.CanExecute = LvCleaner.SelectedItems.Count > 0;\n\n        private async void DeleteCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            if (_indicatorBind.DeleteIndicator) return;\n            _indicatorBind.DeleteIndicator = true;\n            IList input = LvCleaner.SelectedItems;\n            List<CleanModel> output = new List<CleanModel>();\n            Progress<int> progress = new Progress<int>(s => _indicatorBind.DeleteProgress = s);\n            await Task.Run(() => DeleteOp(input, output, progress));\n            output.ForEach(cm => _cleanList.Remove(cm));\n            _indicatorBind.DeleteIndicator = false;\n        }\n\n        private void DirSetup()\n        {\n            string winDir = Environment.GetFolderPath(Environment.SpecialFolder.Windows);\n            Dictionary<string, string> dirPreset = new Dictionary<string, string>\n            {\n                {\"Temporary Directory\", Path.GetTempPath()},\n                {\"Win Temporary Directory\", Path.Combine(winDir, @\"Temp\")},\n                {\"Windows Installer Cache\", Path.Combine(winDir, @\"Installer\\$PatchCache$\\Managed\")},\n                {\"Windows Update Cache\", Path.Combine(winDir, @\"SoftwareDistribution\\Download\")},\n                {\"Windows Logs Directory\", Path.Combine(winDir, @\"Logs\")},\n                {\"Prefetch Cache\", Path.Combine(winDir, @\"Prefetch\")},\n                {\n                    \"Crash Dump Directory\",\n                    Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),\n                        @\"CrashDumps\")\n                },\n                {\"Google Chrome Cache\", Path.Combine(Window7.ChromeDataPath, @\"Default\\Cache\")},\n                {\"Steam Redist Packages\", SteamLibraryDir}\n            };\n            foreach (KeyValuePair<string, string> oneDir in dirPreset)\n                _dirList.Add(new CheckBoxModel(oneDir.Key, oneDir.Value, Directory.Exists(oneDir.Value)));\n        }\n\n        private void LbSidebar_SelectionChanged(object sender, SelectionChangedEventArgs e)\n        {\n            if (e.RemovedItems.Count != 0 || e.AddedItems.Count == 0) return;\n            CheckBoxModel t = (CheckBoxModel) e.AddedItems[0];\n            if (t.Enabled)\n                t.Checked = !t.Checked;\n            LbDir.SelectedIndex = -1;\n        }\n\n        private void LvUsersColumnHeader_Click(object sender, RoutedEventArgs e)\n        {\n            GridViewColumnHeader column = sender as GridViewColumnHeader;\n            string sortBy = column?.Tag.ToString();\n            if (_listViewSortCol != null)\n            {\n                AdornerLayer.GetAdornerLayer(_listViewSortCol).Remove(_listViewSortAdorner);\n                LvCleaner.Items.SortDescriptions.Clear();\n            }\n\n            ListSortDirection newDir = ListSortDirection.Ascending;\n            if (Equals(_listViewSortCol, column) && Equals(_listViewSortAdorner.Direction, newDir))\n                newDir = ListSortDirection.Descending;\n\n            _listViewSortCol = column;\n            _listViewSortAdorner = new SortAdorner(_listViewSortCol, newDir);\n            if (_listViewSortCol != null)\n                AdornerLayer.GetAdornerLayer(_listViewSortCol).Add(_listViewSortAdorner);\n            if (sortBy != null)\n                LvCleaner.Items.SortDescriptions.Add(new SortDescription(sortBy, newDir));\n        }\n\n        private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) => Close();\n\n        private void ScanCmd_CanExecute(object sender, CanExecuteRoutedEventArgs e) =>\n            e.CanExecute = LbDir.Items.Cast<CheckBoxModel>().Any(item => item.Checked);\n\n        private async void ScanCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            BtnAnalyze.Focus(); // NEED TO FOCUS BECAUSE OF DATE PICKER\n            if (_indicatorBind.ScanIndicator) return;\n            MainSnackbar.IsActive = false;\n            _indicatorBind.ScanIndicator = true;\n            _scanElapsed = 1;\n            Stopwatch stopwatchScan = Stopwatch.StartNew();\n            _dispatcherTimer.Start();\n            bool isSteam = false;\n            List<string> selectedDirs = new List<string>();\n            foreach (CheckBoxModel item in _dirList)\n            {\n                if (!item.Checked) continue;\n                if (item.Path.Equals(SteamLibraryDir))\n                {\n                    isSteam = true;\n                    continue;\n                }\n\n                if (Directory.Exists(item.Path))\n                    selectedDirs.Add(item.Path);\n            }\n\n            float maxSize = 0;\n            string multiExt = TBoxTypes.Text.Trim();\n            int depth = Convert.ToInt32(CbBoxLevel.SelectionBoxItem);\n            _date = DateFilter.Text;\n            _befDate = TglDate.IsChecked != null && (bool) !TglDate.IsChecked;\n            ICollection<CleanModel> tList = new List<CleanModel>();\n            await Task.Run(() =>\n                DirectorySearch(selectedDirs, multiExt, tList, depth, isSteam, ref maxSize));\n\n            _dispatcherTimer.Stop();\n            stopwatchScan.Stop();\n            _cleanList = new ObservableCollection<CleanModel>(tList);\n            LvCleaner.ItemsSource = _cleanList;\n\n            if (CheckBoxGroup.IsChecked != null && (bool) CheckBoxGroup.IsChecked)\n            {\n                CollectionView view = (CollectionView) CollectionViewSource.GetDefaultView(LvCleaner.ItemsSource);\n                view.GroupDescriptions.Add(new PropertyGroupDescription(\"Group\"));\n            }\n\n            _indicatorBind.ScanTime = FormatScanTime(stopwatchScan.ElapsedMilliseconds);\n            _indicatorBind.MaxSize = Convert.ToInt32(maxSize);\n            _indicatorBind.ScanIndicator = false;\n        }\n\n        private void DispatcherTimer_Tick(object sender, EventArgs e) =>\n            _indicatorBind.ScanTime = $\"{_scanElapsed++} sec\";\n\n        private static string FormatScanTime(double mSec) => mSec < 1000\n            ? $\"{mSec} ms\"\n            : $\"{mSec / 1000:0.00} sec\";\n\n        private void Window_ContentRendered(object sender, EventArgs e)\n        {\n            Shared.FitWindow.Init(Width, Height);\n            DirSetup();\n            LbDir.ItemsSource = _dirList;\n            CbBoxLevel.ItemsSource = new[] {0, 1, 2, 3, 4, 5, 20};\n            CbBoxLevel.SelectedIndex = 5;\n            StackPanelBtns.DataContext = TbHeader.DataContext = _indicatorBind;\n            MainSnackbarMessage.Content = \"Selecting many items at once can slow scan operation significantly\";\n            MainSnackbar.IsActive = true;\n            _dispatcherTimer.Tick += DispatcherTimer_Tick;\n        }\n\n        private class CheckBoxModel : INotifyPropertyChanged\n        {\n            private bool _checked;\n\n            public CheckBoxModel(string text, string path, bool enabled)\n            {\n                Text = text;\n                Path = path;\n                Enabled = enabled;\n            }\n\n            public event PropertyChangedEventHandler PropertyChanged;\n\n            public bool Checked\n            {\n                get => _checked;\n                set\n                {\n                    if (_checked == value) return;\n                    _checked = value;\n                    NotifyPropertyChanged(nameof(Checked));\n                }\n            }\n\n            public bool Enabled { [UsedImplicitly] get; }\n            public string Path { [UsedImplicitly] get; }\n            public string Text { [UsedImplicitly] get; }\n\n            private void NotifyPropertyChanged(string propName) =>\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));\n        }\n\n        private class CleanModel\n        {\n            public string Date { [UsedImplicitly] get; set; }\n            public string Extension { [UsedImplicitly] get; set; }\n            public string Group { [UsedImplicitly] get; set; }\n            public string Path { [UsedImplicitly] get; set; }\n            public string Size { [UsedImplicitly] get; set; }\n        }\n\n        private class IndicatorModel : INotifyPropertyChanged\n        {\n            private bool _deleteIndicator;\n            private int _deleteProgress;\n            private int _maxSize;\n            private bool _scanIndicator;\n            private string _scanTime;\n\n            public event PropertyChangedEventHandler PropertyChanged;\n\n            public bool DeleteIndicator\n            {\n                [UsedImplicitly] get => _deleteIndicator;\n                set => SetField(ref _deleteIndicator, value);\n            }\n\n            public int DeleteProgress\n            {\n                [UsedImplicitly] get => _deleteProgress;\n                set => SetField(ref _deleteProgress, value);\n            }\n\n            public int MaxSize\n            {\n                [UsedImplicitly] get => _maxSize;\n                set => SetField(ref _maxSize, value);\n            }\n\n            public bool ScanIndicator\n            {\n                [UsedImplicitly] get => _scanIndicator;\n                set => SetField(ref _scanIndicator, value);\n            }\n\n            public string ScanTime\n            {\n                [UsedImplicitly] get => _scanTime;\n                set => SetField(ref _scanTime, value);\n            }\n\n            private void SetField<T>(ref T field, T value, [CallerMemberName] string propName = null)\n            {\n                if (EqualityComparer<T>.Default.Equals(field, value)) return;\n                field = value;\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));\n            }\n        }\n    }\n\n    public static class CleanCmd\n    {\n        public static readonly RoutedCommand Delete = new RoutedCommand(\"Delete\", typeof(CleanCmd),\n            new InputGestureCollection {new KeyGesture(Key.Delete, ModifierKeys.Control)});\n\n        public static readonly RoutedCommand Scan = new RoutedCommand(\"Scan\", typeof(CleanCmd),\n            new InputGestureCollection {new KeyGesture(Key.S, ModifierKeys.Control)});\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/W6_Software.xaml",
    "content": "﻿<mah:MetroWindow x:Class=\"XTR_Toolbox.Window6\"\n                 xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                 xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n                 xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n                 xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n                 xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n                 xmlns:mah=\"http://metro.mahapps.com/winfx/xaml/controls\"\n                 xmlns:self=\"clr-namespace:XTR_Toolbox\"\n                 xmlns:classes=\"clr-namespace:XTR_Toolbox.Classes\"\n                 mc:Ignorable=\"d\"\n                 Title=\"Software Manager\" TitleCharacterCasing=\"Normal\" Height=\"670\" Width=\"930\"\n                 Foreground=\"{StaticResource MaterialDesignBody}\"\n                 Background=\"{DynamicResource MaterialDesignPaper}\"\n                 FontFamily=\"{StaticResource MaterialDesignFont}\"\n                 WindowStartupLocation=\"CenterScreen\" FontSize=\"14\" WindowTransitionsEnabled=\"False\"\n                 ContentRendered=\"Window_ContentRendered\">\n    <mD:DialogHost CloseOnClickAway=\"True\" IsTabStop=\"False\" Identifier=\"RootDialog\">\n        <Grid>\n            <Grid.RowDefinitions>\n                <RowDefinition Height=\"40\" />\n                <RowDefinition Height=\"1*\" />\n                <RowDefinition Height=\"29\" />\n            </Grid.RowDefinitions>\n            <DockPanel Grid.Row=\"0\" Margin=\"10,5\">\n                <mD:PackIcon Kind=\"Filter\" Opacity=\".6\" VerticalAlignment=\"Center\" Margin=\"0,0,5,0\" />\n                <TextBox x:Name=\"TbSearch\" TabIndex=\"0\" VerticalAlignment=\"Center\"\n                         mD:HintAssist.Hint=\" Quick Name Filter\"\n                         TextChanged=\"TbSearch_TextChanged\" />\n            </DockPanel>\n            <ListView x:Name=\"LvSoftware\" Margin=\"0\" Grid.Row=\"1\" FontSize=\"14\"\n                      mD:ListViewAssist.ListViewItemPadding=\"7\"\n                      mD:DataGridAssist.ColumnHeaderPadding=\"7,4\" SelectionChanged=\"LvSoftware_SelectionChanged\">\n                <ListView.ContextMenu>\n                    <ContextMenu>\n                        <MenuItem Command=\"self:SoftwareCmd.Remove\" Icon=\"{mD:PackIcon DeleteForever}\" />\n                        <MenuItem Command=\"self:SoftwareCmd.Force\" Icon=\"{mD:PackIcon FolderRemove}\" />\n                        <Separator />\n                        <MenuItem Command=\"self:SoftwareCmd.Msi\" Icon=\"{mD:PackIcon Autorenew}\"\n                                  CommandParameter=\"Change\" Header=\"Change\" />\n                        <MenuItem Command=\"self:SoftwareCmd.Msi\" Icon=\"{mD:PackIcon Wrench}\"\n                                  CommandParameter=\"Repair\" Header=\"Repair\" />\n                        <Separator />\n                        <MenuItem Command=\"self:SoftwareCmd.Dir\" Icon=\"{mD:PackIcon Folder}\" />\n                        <MenuItem Command=\"self:SoftwareCmd.RegJump\" Icon=\"{mD:PackIcon Apps}\" />\n                        <Separator />\n                        <MenuItem Command=\"self:SoftwareCmd.Clip\" Icon=\"{mD:PackIcon ClipboardOutline}\" />\n                    </ContextMenu>\n                </ListView.ContextMenu>\n                <ListView.View>\n                    <GridView AllowsColumnReorder=\"False\">\n                        <GridViewColumn Width=\"660\">\n                            <GridViewColumn.CellTemplate>\n                                <DataTemplate>\n                                    <StackPanel Orientation=\"Horizontal\" d:DataContext=\"{d:DesignData }\">\n                                        <Image Source=\"{Binding Icon}\" Width=\"18\" Margin=\"0,0,7,0\" />\n                                        <TextBlock Text=\"{Binding Name}\" />\n                                    </StackPanel>\n                                </DataTemplate>\n                            </GridViewColumn.CellTemplate>\n                            <GridViewColumnHeader Tag=\"Name\" Click=\"LvUsersColumnHeader_Click\" Content=\"Name\"\n                                                  FontWeight=\"Bold\" />\n                        </GridViewColumn>\n                        <GridViewColumn DisplayMemberBinding=\"{Binding DateInstalled}\" Width=\"130\">\n                            <GridViewColumnHeader Tag=\"DateInstalled\" Click=\"LvUsersColumnHeader_Click\"\n                                                  Content=\"Date Installed\" />\n                        </GridViewColumn>\n                        <GridViewColumn DisplayMemberBinding=\"{Binding Size}\">\n                            <GridViewColumnHeader Tag=\"Size\" Click=\"LvUsersColumnHeader_Click\" Content=\"Size (MB)\" />\n                        </GridViewColumn>\n                    </GridView>\n                </ListView.View>\n            </ListView>\n            <mD:DrawerHost Grid.Row=\"0\" Grid.RowSpan=\"2\">\n                <mD:DrawerHost.RightDrawerContent>\n                    <ListBox x:Name=\"LbHistory\" Margin=\"6\" Width=\"350\">\n                        <ListBox.ItemTemplate>\n                            <DataTemplate>\n                                <TextBlock Text=\"{Binding History, Mode=OneWay}\" d:DataContext=\"{d:DesignData }\"\n                                           TextWrapping=\"Wrap\" />\n                            </DataTemplate>\n                        </ListBox.ItemTemplate>\n                    </ListBox>\n                </mD:DrawerHost.RightDrawerContent>\n                <StackPanel HorizontalAlignment=\"Right\" VerticalAlignment=\"Bottom\" Margin=\"0,0,25,20\">\n                    <Button Command=\"{x:Static mD:DrawerHost.OpenDrawerCommand}\"\n                            CommandParameter=\"{x:Static Dock.Right}\"\n                            Style=\"{DynamicResource MaterialDesignFloatingActionButton}\"\n                            ToolTip=\"View Log History\" Margin=\"8\">\n                        <mD:PackIcon Kind=\"NoteText\" Width=\"24\" Height=\"24\" />\n                    </Button>\n                </StackPanel>\n            </mD:DrawerHost>\n            <mD:Snackbar MessageQueue=\"{mD:MessageQueue}\" x:Name=\"MainSnackbar\" IsTabStop=\"False\" Grid.Row=\"1\" />\n            <StatusBar Background=\"{DynamicResource PrimaryHueDarkBrush}\"\n                       Grid.Column=\"0\" Grid.Row=\"2\" Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                       FontFamily=\"{StaticResource MaterialDesignFont}\" FontSize=\"16\">\n                <StatusBar.Resources>\n                    <classes:DoubleVisibilityConverter x:Key=\"DoubleVisConverter\" />\n                </StatusBar.Resources>\n                <TextBlock Text=\"{Binding ElementName=LvSoftware, Path=Items.Count, StringFormat='Filtered:  {0}'}\"\n                           Margin=\"5,0,0,0\" />\n                <TextBlock\n                    Text=\"{Binding ElementName=LvSoftware, Path=SelectedItems.Count, StringFormat='Selected:  {0}'}\"\n                    Margin=\"50,0,0,0\" />\n                <TextBlock x:Name=\"BtnSelSize\" Text=\"{Binding SelectedSize, StringFormat='({0} MB)'}\"\n                           Visibility=\"{Binding SelectedSize, Converter={StaticResource DoubleVisConverter}}\"\n                           Margin=\"5,0,0,0\" />\n            </StatusBar>\n        </Grid>\n    </mD:DialogHost>\n    <Window.CommandBindings>\n        <CommandBinding Command=\"self:SoftwareCmd.Msi\" CanExecute=\"MsiCmd_CanExecute\" Executed=\"MsiCmd_Executed\" />\n        <CommandBinding Command=\"self:SoftwareCmd.Dir\" CanExecute=\"LocationCmd_CanExecute\"\n                        Executed=\"OpenDirCmd_Executed\" />\n        <CommandBinding Command=\"self:SoftwareCmd.RegJump\" Executed=\"OpenRegCmd_Executed\" />\n        <CommandBinding Command=\"self:SoftwareCmd.Force\" CanExecute=\"LocationCmd_CanExecute\"\n                        Executed=\"UninstallCmd_Executed\" />\n        <CommandBinding Command=\"self:SoftwareCmd.Remove\" Executed=\"UninstallCmd_Executed\" />\n        <CommandBinding Command=\"self:SoftwareCmd.Clip\" Executed=\"ClipboardCmd_Executed\" />\n        <CommandBinding Command=\"Close\" Executed=\"OnCloseExecuted\" />\n    </Window.CommandBindings>\n    <Window.InputBindings>\n        <KeyBinding Command=\"Close\" Key=\"Escape\" />\n    </Window.InputBindings>\n</mah:MetroWindow>"
  },
  {
    "path": "XTR_Toolbox/W6_Software.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.CompilerServices;\nusing System.Security;\nusing System.Text;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing System.Windows.Media.Imaging;\nusing JetBrains.Annotations;\nusing MaterialDesignThemes.Wpf;\nusing Microsoft.Win32;\nusing XTR_Toolbox.Classes;\nusing XTR_Toolbox.Dialogs;\n\nnamespace XTR_Toolbox\n{\n    public partial class Window6\n    {\n        private static readonly ObservableCollection<SoftwareLogModel> HistoryList =\n            new ObservableCollection<SoftwareLogModel>();\n\n        private static BitmapSource _msiIcon;\n        private readonly IndicatorModel _indiBind = new IndicatorModel();\n\n        private SortAdorner _listViewSortAdorner;\n\n        private GridViewColumnHeader _listViewSortCol;\n        private ObservableCollection<SoftwareModel> _softwareList;\n\n        public Window6()\n        {\n            InitializeComponent();\n        }\n\n        private static double FormatKbToMb(string regSize)\n        {\n            float.TryParse(regSize, out float regSizeNum);\n            return Math.Round(regSizeNum / 1024, 2);\n        }\n\n        private static BitmapSource GetIcon(string regUnin, string regIcon, out bool isMsi)\n        {\n            BitmapSource ico = Shared.PathToIcon(regIcon);\n            isMsi = regUnin.Contains(\"MsiExec\");\n            if (ico != null) return ico;\n            ico = isMsi\n                ? MsiIconToUse(regUnin)\n                : Shared.PathToIcon(regUnin.Substring(0, regUnin.IndexOf(\".exe\", StringComparison.Ordinal) + 4));\n            return ico;\n        }\n\n        private static string GetMsiIconPath(string guid)\n        {\n            int startIndex = guid.IndexOf('{') + 1;\n            guid = guid.Substring(startIndex, guid.IndexOf('}') - startIndex).Replace(\"-\", \"\");\n            int[] pattern = {8, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2};\n            StringBuilder returnString = new StringBuilder();\n            int index = 0;\n            foreach (int length in pattern)\n            {\n                returnString.Append(guid.Substring(index, length).Reverse().ToArray());\n                index += length;\n            }\n\n            string decodedGuid = returnString.ToString();\n            string icoPath =\n                Registry.ClassesRoot.OpenSubKey(@\"Installer\\Products\\\" + decodedGuid)?.GetValue(\"ProductIcon\", \"\")\n                    .ToString() ?? Registry.CurrentUser\n                    .OpenSubKey(@\"Software\\Microsoft\\Installer\\Products\\\" + decodedGuid)\n                    ?.GetValue(\"ProductIcon\", \"\").ToString();\n            return File.Exists(icoPath) ? icoPath : null;\n        }\n\n        private static void GetSoftware(ICollection<SoftwareModel> tList)\n        {\n            const string uninstallKey = @\"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\";\n            RegistryKey[] keys =\n            {\n                Registry.LocalMachine.OpenSubKey(uninstallKey),\n                RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(uninstallKey),\n                Registry.CurrentUser.OpenSubKey(uninstallKey)\n            };\n            try\n            {\n                foreach (RegistryKey key in keys)\n                {\n                    foreach (string subSoftware in key.GetSubKeyNames())\n                        try\n                        {\n                            using (RegistryKey subKey = key.OpenSubKey(subSoftware))\n                            {\n                                if (subKey == null) continue;\n                                string regName = subKey.GetValue(\"DisplayName\", \"\").ToString();\n                                string regUnin = subKey.GetValue(\"UninstallString\", \"\").ToString().Replace(\"\\\"\", \"\");\n                                if (regName.Length == 0 || regUnin.Length == 0) continue;\n                                string regKey = subKey.ToString();\n                                string regLoca = subKey.GetValue(\"InstallLocation\", \"\").ToString();\n                                string regDate = subKey.GetValue(\"InstallDate\", \"\").ToString();\n                                string regSize = subKey.GetValue(\"EstimatedSize\", \"\").ToString();\n                                string regIcon = subKey.GetValue(\"DisplayIcon\", \"\").ToString().Replace(\"\\\"\", \"\");\n                                BitmapSource ico = GetIcon(regUnin, regIcon, out bool isMsi);\n                                tList.Add(new SoftwareModel\n                                {\n                                    Name = regName + \"  \" + GetVersion(subKey, regName),\n                                    Size = FormatKbToMb(regSize),\n                                    DateInstalled = ParseDate(regDate, regUnin),\n                                    Uninstall = regUnin,\n                                    Icon = ico,\n                                    IsMsi = isMsi,\n                                    Location = regLoca,\n                                    RegPath = regKey\n                                });\n                            }\n                        }\n                        catch\n                        {\n                            // ignored\n                        }\n\n                    key.Close();\n                }\n            }\n            catch (SecurityException ex)\n            {\n                MessageBox.Show(\"No permission to read registry. Try to run as Administrator.\\nError: \" + ex.Message);\n            }\n        }\n\n        private static string GetVersion(RegistryKey subKey, string regName)\n        {\n            if (\"0123456789\".Contains(regName.ElementAt(regName.Length - 1))) return \"\";\n            string regVer = subKey.GetValue(\"DisplayVersion\", \"\").ToString();\n            return regName.Contains(regVer) ? \"\" : regVer;\n        }\n\n        private static BitmapSource MsiIconToUse(string regUnin)\n        {\n            BitmapSource msiIcon = Shared.PathToIcon(GetMsiIconPath(regUnin)) ?? _msiIcon;\n            return msiIcon;\n        }\n\n        private static string ParseDate(string regDate, string regRemv)\n        {\n            DateTime.TryParseExact(regDate, \"yyyyMMdd\", null, DateTimeStyles.None, out DateTime dd);\n            string date;\n            if (dd.Date.Ticks != 0)\n            {\n                date = dd.ToString(\"yyyy-MM-dd\");\n            }\n            else\n            {\n                regRemv = regRemv.Substring(0, regRemv.LastIndexOf(\"\\\\\", StringComparison.Ordinal));\n                date = Directory.Exists(regRemv) ? Directory.GetLastAccessTime(regRemv).ToString(\"yyyy-MM-dd\") : \"\";\n            }\n\n            return date;\n        }\n\n        private static ObservableCollection<SoftwareModel> PopulateSoftware()\n        {\n            try\n            {\n                _msiIcon = Shared.PathToIcon(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.System),\n                    \"msiexec.exe\"));\n            }\n            catch\n            {\n                _msiIcon = null;\n            }\n\n            ICollection<SoftwareModel> tList = new List<SoftwareModel>();\n            GetSoftware(tList);\n            return new ObservableCollection<SoftwareModel>(tList);\n        }\n\n        private static bool Uninstall(string uninstallPath, bool isMsi)\n        {\n            int separatorIndex = uninstallPath.IndexOf(\".exe\", StringComparison.Ordinal);\n            if (separatorIndex < 1)\n                return false;\n            string arg = uninstallPath.Substring(separatorIndex + 4);\n            uninstallPath = uninstallPath.Substring(0, separatorIndex + 4);\n            if (isMsi)\n                arg = arg.Replace(\"/I\", \"/X\");\n            if (!File.Exists(uninstallPath) && !isMsi) return true;\n            int exitCode = CustomProc.StartProc(uninstallPath, arg);\n            return (!isMsi || exitCode == 0) && !File.Exists(uninstallPath);\n        }\n\n        private void ClipboardCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            StringBuilder sb = new StringBuilder();\n            int maxNameLength = (from SoftwareModel t in LvSoftware.SelectedItems select t.Name.Length)\n                .Concat(new[] {0}).Max();\n            foreach (SoftwareModel t in LvSoftware.SelectedItems)\n            {\n                string format = \"{0,-\" + maxNameLength + \"}  |{1,12}  |{2,11}\";\n                sb.AppendFormat(format, t.Name, t.DateInstalled, t.Size);\n                sb.AppendLine();\n            }\n\n            Clipboard.SetText(sb.ToString());\n        }\n\n        private void LocationCmd_CanExecute(object sender, CanExecuteRoutedEventArgs e)\n        {\n            e.CanExecute = LvSoftware.SelectedItems.Cast<SoftwareModel>()\n                .All(item => !string.IsNullOrEmpty(item.Location));\n        }\n\n        private void LvSoftware_SelectionChanged(object sender, SelectionChangedEventArgs e)\n        {\n            if (((ListView) sender).SelectedItems.Count == 0)\n            {\n                _indiBind.SelectedSize = 0;\n                return;\n            }\n\n            foreach (double s in e.AddedItems.Cast<SoftwareModel>().Select(it => it.Size))\n                _indiBind.SelectedSize += s;\n\n            foreach (double s in e.RemovedItems.Cast<SoftwareModel>().Select(it => it.Size))\n                _indiBind.SelectedSize -= s;\n        }\n\n        private void LvUsersColumnHeader_Click(object sender, RoutedEventArgs e)\n        {\n            GridViewColumnHeader column = sender as GridViewColumnHeader;\n            string sortBy = column?.Tag.ToString();\n            if (_listViewSortCol != null)\n            {\n                AdornerLayer.GetAdornerLayer(_listViewSortCol).Remove(_listViewSortAdorner);\n                LvSoftware.Items.SortDescriptions.Clear();\n            }\n\n            ListSortDirection newDir = ListSortDirection.Ascending;\n            if (Equals(_listViewSortCol, column) && Equals(_listViewSortAdorner.Direction, newDir))\n                newDir = ListSortDirection.Descending;\n\n            _listViewSortCol = column;\n            _listViewSortAdorner = new SortAdorner(_listViewSortCol, newDir);\n            if (_listViewSortCol != null) AdornerLayer.GetAdornerLayer(_listViewSortCol).Add(_listViewSortAdorner);\n            if (sortBy != null) LvSoftware.Items.SortDescriptions.Add(new SortDescription(sortBy, newDir));\n        }\n\n        private void MsiCmd_CanExecute(object sender, CanExecuteRoutedEventArgs e) =>\n            e.CanExecute = LvSoftware.SelectedItems.Cast<SoftwareModel>().All(item => item.IsMsi);\n\n        private async void MsiCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            int selCount = LvSoftware.SelectedItems.Count;\n            if (selCount > 20)\n            {\n                object result = await DialogHost.Show(\n                    new GenYesNoUc($\"Are you sure you want to work with {selCount} items?\"), \"RootDialog\");\n                if (result == null || result.ToString() != \"Y\") return;\n            }\n\n            for (int index = selCount - 1; index >= 0; index--)\n            {\n                SoftwareModel item = (SoftwareModel) LvSoftware.SelectedItems[index];\n                string msiExec = item.Uninstall;\n                int separatorIndex = msiExec.IndexOf(\".exe\", StringComparison.Ordinal);\n                if (separatorIndex < 1)\n                    return;\n                string arg = msiExec.Substring(separatorIndex + 4);\n                msiExec = msiExec.Substring(0, separatorIndex + 4);\n                switch (e.Parameter)\n                {\n                    case \"Change\":\n                        arg = arg.Replace(\"/X\", \"/I\");\n                        CustomProc.StartProc(msiExec, arg);\n                        break;\n                    case \"Repair\":\n                        arg = arg.Replace(\"/X\", \"/I\").Replace(\"/I\", \"/F \");\n                        CustomProc.StartProc(msiExec, arg);\n                        break;\n                }\n            }\n        }\n\n        private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) => Close();\n\n        private void OpenDirCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            try\n            {\n                foreach (SoftwareModel item in LvSoftware.SelectedItems)\n                    CustomProc.StartProc(item.Location, wait: false);\n            }\n            catch\n            {\n                //ignored\n            }\n        }\n\n        private void OpenRegCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            try\n            {\n                foreach (SoftwareModel item in LvSoftware.SelectedItems)\n                {\n                    Registry.SetValue(@\"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Regedit\",\n                        \"LastKey\",\n                        item.RegPath);\n                    // Need 64-bit Process v3.0\n                    CustomProc.StartProc(\"regedit\", \"-m\", wait: false);\n                }\n            }\n            catch\n            {\n                // ignored\n            }\n        }\n\n        private void TbSearch_TextChanged(object sender, TextChangedEventArgs e) =>\n            CollectionViewSource.GetDefaultView(LvSoftware.ItemsSource).Refresh();\n\n        private async void UninstallCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            if (!(e.Command is RoutedUICommand eCommand)) return;\n            if (eCommand == SoftwareCmd.Force)\n            {\n                string[] dirsRemove = LvSoftware.SelectedItems.Cast<SoftwareModel>()\n                    .Where(it => !string.IsNullOrEmpty(it.Location)).Select(it => it.Location).ToArray();\n                IEnumerable<string> regsRemove = LvSoftware.SelectedItems.Cast<SoftwareModel>()\n                    .Select(it => it.RegPath);\n                new ForceRemoveDialog(dirsRemove, regsRemove) {Owner = this}.ShowDialog();\n                if (!ForceRemoveDialog.ForceOk) return;\n            }\n\n            int selCount = LvSoftware.SelectedItems.Count;\n            if (selCount > 20)\n            {\n                object result = await DialogHost.Show(\n                    new GenYesNoUc($\"Are you sure you want to uninstall {selCount} items?\"), \"RootDialog\");\n                if (result == null || result.ToString() != \"Y\") return;\n            }\n\n            for (int index = selCount - 1; index >= 0; index--)\n            {\n                SoftwareModel item = (SoftwareModel) LvSoftware.SelectedItems[index];\n                if (!Uninstall(item.Uninstall, item.IsMsi)) continue;\n                if (ForceRemoveDialog.ForceOk)\n                    try\n                    {\n                        string[] splitOnHive = item.RegPath.Split(new[] {'\\\\'}, 2);\n                        RegistryHive regHive = Shared.StringToRegistryHive(splitOnHive[0]);\n                        RegistryKey.OpenBaseKey(regHive, RegistryView.Registry32)\n                            .DeleteSubKeyTree(splitOnHive[1], false);\n                        RegistryKey.OpenBaseKey(regHive, RegistryView.Registry64)\n                            .DeleteSubKeyTree(splitOnHive[1], false);\n                        if (Directory.Exists(item.Location))\n                            Directory.Delete(item.Location, true);\n                    }\n                    catch\n                    {\n                        //ignored\n                    }\n\n                _softwareList.Remove(item);\n                HistoryList.Add(new SoftwareLogModel\n                    {History = $\"{DateTime.Now.ToShortTimeString()} - {item.Name} : Uninstalled\"});\n            }\n        }\n\n        private bool UserFilter(object item)\n        {\n            if (TbSearch.Text.Length == 0) return true;\n            return ((SoftwareModel) item).Name.IndexOf(TbSearch.Text, StringComparison.OrdinalIgnoreCase) >= 0;\n        }\n\n        private void Window_ContentRendered(object sender, EventArgs e)\n        {\n            Shared.FitWindow.Init(Width, Height);\n            _softwareList = PopulateSoftware();\n            LvSoftware.ItemsSource = _softwareList;\n            CollectionView view = (CollectionView) CollectionViewSource.GetDefaultView(LvSoftware.ItemsSource);\n            view.SortDescriptions.Add(new SortDescription(\"DateInstalled\", ListSortDirection.Descending));\n            view.Filter = UserFilter;\n            BtnSelSize.DataContext = _indiBind;\n            TbSearch.Focus();\n            LbHistory.ItemsSource = HistoryList;\n            Shared.ShowSnackBar(MainSnackbar);\n        }\n\n        private class IndicatorModel : INotifyPropertyChanged\n        {\n            private double _selectedSize;\n\n            public event PropertyChangedEventHandler PropertyChanged;\n\n            public double SelectedSize\n            {\n                [UsedImplicitly] get => _selectedSize;\n                set\n                {\n                    _selectedSize = _selectedSize < 0 ? 0 : Math.Round(value, 2);\n                    NotifyPropertyChanged();\n                }\n            }\n\n            private void NotifyPropertyChanged([CallerMemberName] string propName = null) =>\n                PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propName));\n        }\n\n        private class SoftwareLogModel\n        {\n            public string History { [UsedImplicitly] get; set; }\n        }\n\n        private class SoftwareModel\n        {\n            public string DateInstalled { [UsedImplicitly] get; set; }\n            public BitmapSource Icon { [UsedImplicitly] get; set; }\n            public bool IsMsi { [UsedImplicitly] get; set; }\n            public string Location { [UsedImplicitly] get; set; }\n            public string Name { [UsedImplicitly] get; set; }\n            public string RegPath { [UsedImplicitly] get; set; }\n            public double Size { [UsedImplicitly] get; set; }\n            public string Uninstall { [UsedImplicitly] get; set; }\n        }\n    }\n\n    public static class SoftwareCmd\n    {\n        public static readonly RoutedUICommand Clip = new RoutedUICommand(\"Copy to Clipboard\", \"Clip\",\n            typeof(SoftwareCmd), new InputGestureCollection {new KeyGesture(Key.C, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Dir = new RoutedUICommand(\"Open Directory\", \"Dir\",\n            typeof(SoftwareCmd), new InputGestureCollection {new KeyGesture(Key.O, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Force = new RoutedUICommand(\"Force Remove...\", \"Force\",\n            typeof(SoftwareCmd), new InputGestureCollection {new KeyGesture(Key.F, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Msi = new RoutedUICommand();\n\n        public static readonly RoutedUICommand RegJump = new RoutedUICommand(\"Open in Registry\", \"Reg\",\n            typeof(SoftwareCmd), new InputGestureCollection {new KeyGesture(Key.J, ModifierKeys.Control)});\n\n        public static readonly RoutedUICommand Remove = new RoutedUICommand(\"Uninstall\", \"Rem\",\n            typeof(SoftwareCmd), new InputGestureCollection {new KeyGesture(Key.R, ModifierKeys.Control)});\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/W7_Addons.xaml",
    "content": "﻿<mah:MetroWindow x:Class=\"XTR_Toolbox.Window7\"\n                 xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\"\n                 xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\"\n                 xmlns:d=\"http://schemas.microsoft.com/expression/blend/2008\"\n                 xmlns:mc=\"http://schemas.openxmlformats.org/markup-compatibility/2006\"\n                 xmlns:mD=\"http://materialdesigninxaml.net/winfx/xaml/themes\"\n                 xmlns:mah=\"http://metro.mahapps.com/winfx/xaml/controls\"\n                 xmlns:self=\"clr-namespace:XTR_Toolbox\"\n                 mc:Ignorable=\"d\"\n                 Title=\"Chrome Extensions Manager\" TitleCharacterCasing=\"Normal\" Height=\"720\" Width=\"700\"\n                 Foreground=\"{StaticResource MaterialDesignBody}\"\n                 Background=\"{DynamicResource MaterialDesignPaper}\"\n                 FontFamily=\"{StaticResource MaterialDesignFont}\"\n                 WindowStartupLocation=\"CenterScreen\" FontSize=\"14\" WindowTransitionsEnabled=\"False\"\n                 ContentRendered=\"Window_ContentRendered\">\n    <mD:DialogHost CloseOnClickAway=\"True\" IsTabStop=\"False\" Identifier=\"RootDialog\">\n        <Grid>\n            <Grid.RowDefinitions>\n                <RowDefinition Height=\"40\" />\n                <RowDefinition Height=\"1*\" />\n                <RowDefinition Height=\"29\" />\n            </Grid.RowDefinitions>\n            <DockPanel Grid.Row=\"0\" Margin=\"10,5\">\n                <mD:PackIcon Kind=\"Filter\" Opacity=\".6\" VerticalAlignment=\"Center\" Margin=\"0,0,5,0\" />\n                <TextBox x:Name=\"TbSearch\" TabIndex=\"0\" VerticalAlignment=\"Center\"\n                         mD:HintAssist.Hint=\" Quick Name Filter\"\n                         TextChanged=\"TbSearch_TextChanged\" />\n            </DockPanel>\n            <ListView x:Name=\"LvAddons\" Margin=\"0\" Grid.Row=\"1\" FontSize=\"14\" mD:ListViewAssist.ListViewItemPadding=\"7\"\n                      mD:DataGridAssist.ColumnHeaderPadding=\"7,4\">\n                <ListView.ContextMenu>\n                    <ContextMenu>\n                        <MenuItem Command=\"self:BrowserCmd.Delete\" Icon=\"{mD:PackIcon Delete}\" />\n                    </ContextMenu>\n                </ListView.ContextMenu>\n                <ListView.View>\n                    <GridView AllowsColumnReorder=\"False\">\n                        <GridViewColumn DisplayMemberBinding=\"{Binding Name}\" Width=\"290\">\n                            <GridViewColumnHeader Tag=\"Name\" Click=\"LvUsersColumnHeader_Click\" Content=\"Name\"\n                                                  FontWeight=\"Bold\" />\n                        </GridViewColumn>\n                        <GridViewColumn DisplayMemberBinding=\"{Binding Id}\" Width=\"280\">\n                            <GridViewColumnHeader Tag=\"Id\" Click=\"LvUsersColumnHeader_Click\" Content=\"ID\" />\n                        </GridViewColumn>\n                    </GridView>\n                </ListView.View>\n            </ListView>\n            <mD:Snackbar MessageQueue=\"{mD:MessageQueue}\" x:Name=\"MainSnackbar\" IsTabStop=\"False\" Grid.Row=\"1\" />\n            <StatusBar Background=\"{DynamicResource PrimaryHueDarkBrush}\"\n                       Grid.Column=\"0\" Grid.Row=\"2\" Foreground=\"{DynamicResource PrimaryHueMidForegroundBrush}\"\n                       FontFamily=\"{StaticResource MaterialDesignFont}\" FontSize=\"16\">\n                <TextBlock Text=\"{Binding ElementName=LvAddons, Path=Items.Count, StringFormat='Total:  {0}'}\"\n                           Margin=\"5,0,0,0\" />\n                <TextBlock\n                    Text=\"{Binding ElementName=LvAddons, Path=SelectedItems.Count, StringFormat='Selected: {0}'}\"\n                    Margin=\"50,0,0,0\" />\n            </StatusBar>\n        </Grid>\n    </mD:DialogHost>\n    <Window.CommandBindings>\n        <CommandBinding Command=\"self:BrowserCmd.Delete\" Executed=\"DeleteCmd_Executed\" />\n        <CommandBinding Command=\"Close\" Executed=\"OnCloseExecuted\" />\n    </Window.CommandBindings>\n    <Window.InputBindings>\n        <KeyBinding Command=\"Close\" Key=\"Escape\" />\n    </Window.InputBindings>\n</mah:MetroWindow>"
  },
  {
    "path": "XTR_Toolbox/W7_Addons.xaml.cs",
    "content": "﻿using System;\nusing System.Collections.Generic;\nusing System.Collections.ObjectModel;\nusing System.ComponentModel;\nusing System.Diagnostics;\nusing System.IO;\nusing System.Linq;\nusing System.Windows;\nusing System.Windows.Controls;\nusing System.Windows.Data;\nusing System.Windows.Documents;\nusing System.Windows.Input;\nusing JetBrains.Annotations;\nusing MaterialDesignThemes.Wpf;\nusing Newtonsoft.Json.Linq;\nusing XTR_Toolbox.Classes;\nusing XTR_Toolbox.Dialogs;\n\nnamespace XTR_Toolbox\n{\n    public partial class Window7\n    {\n        internal static readonly string ChromeDataPath = Path.Combine(\n            Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),\n            @\"Google\\Chrome\\User Data\\\");\n\n        private readonly ObservableCollection<AddonModel> _addonList = new ObservableCollection<AddonModel>();\n\n        private readonly List<string> _chromeProfileNames = new List<string>();\n        private SortAdorner _listViewSortAdorner;\n        private GridViewColumnHeader _listViewSortCol;\n\n        public Window7()\n        {\n            InitializeComponent();\n            PopulateAddons();\n            DataContext = new AddonModel();\n            LvAddons.ItemsSource = _addonList;\n            CollectionView view = (CollectionView) CollectionViewSource.GetDefaultView(LvAddons.ItemsSource);\n            view.Filter = UserFilter;\n            TbSearch.Focus();\n            Shared.ShowSnackBar(MainSnackbar);\n        }\n\n        internal static bool ChromeExists() => Directory.Exists(ChromeDataPath);\n\n        private static IEnumerable<string> GetProfileNames()\n        {\n            string localJsonChrome = Path.Combine(ChromeDataPath, \"Local State\");\n            JEnumerable<JToken> tokenEnumProfile =\n                JObject.Parse(File.ReadAllText(localJsonChrome))[\"profile\"][\"info_cache\"].Children();\n            List<string> profileList = tokenEnumProfile\n                .Select(item => item.Path.Substring(item.Path.LastIndexOf(\".\", StringComparison.Ordinal) + 1)).ToList();\n            return profileList;\n        }\n\n        private async void DeleteCmd_Executed(object sender, ExecutedRoutedEventArgs e)\n        {\n            int selCount = LvAddons.SelectedItems.Count;\n            if (selCount > 20)\n            {\n                object result = await DialogHost.Show(\n                    new GenYesNoUc($\"Are you sure you want to delete {selCount} items?\"), \"RootDialog\");\n                if (result == null || result.ToString() != \"Y\") return;\n            }\n\n            if (Process.GetProcessesByName(\"chrome\").Length > 0)\n            {\n                object result = await DialogHost.Show(new ChromeProcessUc(), \"RootDialog\");\n                if (result == null || result.ToString() != \"Y\") return;\n                CustomProc.KillAllProc(\"chrome\");\n            }\n\n            for (int index = selCount - 1; index >= 0; index--)\n            {\n                AddonModel item = (AddonModel) LvAddons.SelectedItems[index];\n                try\n                {\n                    Directory.Delete(Path.Combine(item.Path, item.Id), true);\n                    _addonList.Remove(item);\n                }\n                catch\n                {\n                    //ignored\n                }\n            }\n        }\n\n        private void LvUsersColumnHeader_Click(object sender, RoutedEventArgs e)\n        {\n            GridViewColumnHeader column = sender as GridViewColumnHeader;\n            string sortBy = column?.Tag.ToString();\n            if (_listViewSortCol != null)\n            {\n                AdornerLayer.GetAdornerLayer(_listViewSortCol).Remove(_listViewSortAdorner);\n                LvAddons.Items.SortDescriptions.Clear();\n            }\n\n            ListSortDirection newDir = ListSortDirection.Ascending;\n            if (Equals(_listViewSortCol, column) && Equals(_listViewSortAdorner.Direction, newDir))\n                newDir = ListSortDirection.Descending;\n\n            _listViewSortCol = column;\n            _listViewSortAdorner = new SortAdorner(_listViewSortCol, newDir);\n            if (_listViewSortCol != null) AdornerLayer.GetAdornerLayer(_listViewSortCol).Add(_listViewSortAdorner);\n            if (sortBy != null) LvAddons.Items.SortDescriptions.Add(new SortDescription(sortBy, newDir));\n        }\n\n        private void OnCloseExecuted(object sender, ExecutedRoutedEventArgs e) => Close();\n\n        private void PopulateAddons()\n        {\n            _chromeProfileNames.AddRange(GetProfileNames());\n            foreach (string prof in _chromeProfileNames)\n            {\n                string chromeAddonDir = Path.Combine(ChromeDataPath, prof, \"Extensions\");\n                if (!Directory.Exists(chromeAddonDir))\n                {\n                    MessageBox.Show(\"Error scanning for extensions.\");\n                    return;\n                }\n\n                string[] addonsIdDirs = Directory.GetDirectories(chromeAddonDir);\n\n                string secureJsonChrome = Path.Combine(ChromeDataPath, prof, \"Secure Preferences\");\n                if (!File.Exists(secureJsonChrome)) return;\n                JObject o = JObject.Parse(File.ReadAllText(secureJsonChrome));\n                JToken ids = o[\"extensions\"][\"settings\"];\n\n                foreach (JToken i in ids)\n                {\n                    string addonId = i.Path.Substring(i.Path.LastIndexOf(\".\", StringComparison.Ordinal) + 1);\n                    if (!addonsIdDirs.Any(m => m.Contains(addonId))) continue;\n                    try\n                    {\n                        string addonName = (string) i.First[\"manifest\"][\"name\"];\n                        _addonList.Add(new AddonModel\n                        {\n                            Id = addonId,\n                            Name = addonName,\n                            Path = chromeAddonDir\n                        });\n                    }\n                    catch\n                    {\n                        // ignored\n                    }\n                }\n            }\n        }\n\n        private void TbSearch_TextChanged(object sender, TextChangedEventArgs e) =>\n            CollectionViewSource.GetDefaultView(LvAddons.ItemsSource).Refresh();\n\n        private bool UserFilter(object item)\n        {\n            if (TbSearch.Text.Length == 0) return true;\n            return ((AddonModel) item).Name.IndexOf(TbSearch.Text, StringComparison.OrdinalIgnoreCase) >= 0;\n        }\n\n        private void Window_ContentRendered(object sender, EventArgs e)\n        {\n            Shared.FitWindow.Init(Width, Height);\n            if (!ChromeExists()) Close();\n        }\n\n        private class AddonModel\n        {\n            public string Id { [UsedImplicitly] get; set; }\n            public string Name { [UsedImplicitly] get; set; }\n            public string Path { [UsedImplicitly] get; set; }\n        }\n    }\n\n    public static class BrowserCmd\n    {\n        public static readonly RoutedUICommand Delete = new RoutedUICommand(\"Delete\", \"Del\", typeof(BrowserCmd),\n            new InputGestureCollection {new KeyGesture(Key.Delete, ModifierKeys.Control)});\n    }\n}"
  },
  {
    "path": "XTR_Toolbox/XTR_Toolbox.csproj",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"15.0\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n  <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n  <PropertyGroup>\n    <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n    <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n    <ProjectGuid>{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}</ProjectGuid>\n    <OutputType>WinExe</OutputType>\n    <RootNamespace>XTR_Toolbox</RootNamespace>\n    <AssemblyName>XTR_Toolbox</AssemblyName>\n    <TargetFrameworkVersion>v4.7</TargetFrameworkVersion>\n    <FileAlignment>512</FileAlignment>\n    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>\n    <WarningLevel>4</WarningLevel>\n    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>\n    <TargetFrameworkProfile />\n    <IsWebBootstrapper>false</IsWebBootstrapper>\n    <PublishUrl>publish\\</PublishUrl>\n    <Install>true</Install>\n    <InstallFrom>Disk</InstallFrom>\n    <UpdateEnabled>false</UpdateEnabled>\n    <UpdateMode>Foreground</UpdateMode>\n    <UpdateInterval>7</UpdateInterval>\n    <UpdateIntervalUnits>Days</UpdateIntervalUnits>\n    <UpdatePeriodically>false</UpdatePeriodically>\n    <UpdateRequired>false</UpdateRequired>\n    <MapFileExtensions>true</MapFileExtensions>\n    <ApplicationRevision>0</ApplicationRevision>\n    <ApplicationVersion>1.0.0.%2a</ApplicationVersion>\n    <UseApplicationTrust>false</UseApplicationTrust>\n    <BootstrapperEnabled>true</BootstrapperEnabled>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugSymbols>true</DebugSymbols>\n    <DebugType>full</DebugType>\n    <Optimize>false</Optimize>\n    <OutputPath>bin\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' \">\n    <PlatformTarget>AnyCPU</PlatformTarget>\n    <DebugType>pdbonly</DebugType>\n    <Optimize>true</Optimize>\n    <OutputPath>bin\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <ErrorReport>prompt</ErrorReport>\n    <WarningLevel>4</WarningLevel>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x64'\">\n    <DebugSymbols>true</DebugSymbols>\n    <OutputPath>bin\\x64\\Debug\\</OutputPath>\n    <DefineConstants>DEBUG;TRACE</DefineConstants>\n    <DebugType>full</DebugType>\n    <PlatformTarget>x64</PlatformTarget>\n    <ErrorReport>prompt</ErrorReport>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n    <Prefer32Bit>true</Prefer32Bit>\n  </PropertyGroup>\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x64'\">\n    <OutputPath>bin\\x64\\Release\\</OutputPath>\n    <DefineConstants>TRACE</DefineConstants>\n    <Optimize>true</Optimize>\n    <DebugType>pdbonly</DebugType>\n    <PlatformTarget>x64</PlatformTarget>\n    <ErrorReport>prompt</ErrorReport>\n    <CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>\n    <Prefer32Bit>true</Prefer32Bit>\n  </PropertyGroup>\n  <PropertyGroup>\n    <ApplicationIcon>XTR_Toolbox.ico</ApplicationIcon>\n  </PropertyGroup>\n  <ItemGroup>\n    <Reference Include=\"System\" />\n    <Reference Include=\"System.Drawing\" />\n    <Reference Include=\"System.Runtime\" />\n    <Reference Include=\"System.ServiceProcess\" />\n    <Reference Include=\"System.Xml\" />\n    <Reference Include=\"System.Core\" />\n    <Reference Include=\"System.Xml.Linq\" />\n    <Reference Include=\"System.Net.Http\" />\n    <Reference Include=\"System.Xaml\">\n      <RequiredTargetFramework>4.0</RequiredTargetFramework>\n    </Reference>\n    <Reference Include=\"Windows\">\n      <HintPath>..\\..\\..\\..\\..\\..\\..\\Program Files (x86)\\Windows Kits\\10\\UnionMetadata\\Windows.winmd</HintPath>\n    </Reference>\n    <Reference Include=\"WindowsBase\" />\n    <Reference Include=\"PresentationCore\" />\n    <Reference Include=\"PresentationFramework\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ApplicationDefinition Include=\"App.xaml\">\n      <Generator>MSBuild:Compile</Generator>\n      <SubType>Designer</SubType>\n    </ApplicationDefinition>\n    <Compile Include=\"Classes\\ColumnSorter.cs\" />\n    <Compile Include=\"Classes\\CustomProc.cs\" />\n    <Compile Include=\"Classes\\Shared.cs\" />\n    <Compile Include=\"Classes\\Converters.cs\" />\n    <Compile Include=\"Dialogs\\ChromeProcessUc.xaml.cs\">\n      <DependentUpon>ChromeProcessUc.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"Dialogs\\ForceRemoveDialog.xaml.cs\">\n      <DependentUpon>ForceRemoveDialog.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"Dialogs\\GenYesNoUc.xaml.cs\">\n      <DependentUpon>GenYesNoUc.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"Dialogs\\RemoveTelemetryUc.xaml.cs\">\n      <DependentUpon>RemoveTelemetryUc.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"Dialogs\\StartupCreateUc.xaml.cs\">\n      <DependentUpon>StartupCreateUc.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"Dialogs\\QuickToolsUc.xaml.cs\">\n      <DependentUpon>QuickToolsUc.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"W1_WinApps.xaml.cs\">\n      <DependentUpon>W1_WinApps.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"W2_Autoruns.xaml.cs\">\n      <DependentUpon>W2_Autoruns.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"W3_Services.xaml.cs\">\n      <DependentUpon>W3_Services.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"W4_Hosts.xaml.cs\">\n      <DependentUpon>W4_Hosts.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"W5_Cleanup.xaml.cs\">\n      <DependentUpon>W5_Cleanup.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"W6_Software.xaml.cs\">\n      <DependentUpon>W6_Software.xaml</DependentUpon>\n    </Compile>\n    <Compile Include=\"W7_Addons.xaml.cs\">\n      <DependentUpon>W7_Addons.xaml</DependentUpon>\n    </Compile>\n    <Page Include=\"Dialogs\\ChromeProcessUc.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"Dialogs\\ForceRemoveDialog.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"Dialogs\\GenYesNoUc.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"Dialogs\\RemoveTelemetryUc.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"Dialogs\\StartupCreateUc.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"MainWindow.xaml\">\n      <Generator>MSBuild:Compile</Generator>\n      <SubType>Designer</SubType>\n    </Page>\n    <Compile Include=\"App.xaml.cs\">\n      <DependentUpon>App.xaml</DependentUpon>\n      <SubType>Code</SubType>\n    </Compile>\n    <Compile Include=\"MainWindow.xaml.cs\">\n      <DependentUpon>MainWindow.xaml</DependentUpon>\n      <SubType>Code</SubType>\n    </Compile>\n    <Page Include=\"Dialogs\\QuickToolsUc.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"W1_WinApps.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"W2_Autoruns.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"W3_Services.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"W4_Hosts.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"W5_Cleanup.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"W6_Software.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n    <Page Include=\"W7_Addons.xaml\">\n      <SubType>Designer</SubType>\n      <Generator>MSBuild:Compile</Generator>\n    </Page>\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Include=\"Properties\\AssemblyInfo.cs\">\n      <SubType>Code</SubType>\n    </Compile>\n    <Compile Include=\"Properties\\Resources.Designer.cs\">\n      <AutoGen>True</AutoGen>\n      <DesignTime>True</DesignTime>\n      <DependentUpon>Resources.resx</DependentUpon>\n    </Compile>\n    <EmbeddedResource Include=\"Properties\\Resources.resx\">\n      <Generator>ResXFileCodeGenerator</Generator>\n      <LastGenOutput>Resources.Designer.cs</LastGenOutput>\n      <SubType>Designer</SubType>\n    </EmbeddedResource>\n  </ItemGroup>\n  <ItemGroup>\n    <None Include=\"App.config\" />\n  </ItemGroup>\n  <ItemGroup>\n    <PackageReference Include=\"Costura.Fody\">\n      <Version>4.1.0</Version>\n    </PackageReference>\n    <PackageReference Include=\"JetBrains.Annotations\">\n      <Version>2021.2.0</Version>\n    </PackageReference>\n    <PackageReference Include=\"MahApps.Metro\">\n      <Version>2.4.7</Version>\n    </PackageReference>\n    <PackageReference Include=\"MaterialDesignThemes\">\n      <Version>4.2.1</Version>\n    </PackageReference>\n    <PackageReference Include=\"MaterialDesignThemes.MahApps\">\n      <Version>0.1.9</Version>\n    </PackageReference>\n    <PackageReference Include=\"Newtonsoft.Json\">\n      <Version>13.0.1</Version>\n    </PackageReference>\n  </ItemGroup>\n  <ItemGroup>\n    <Resource Include=\"XTR_Toolbox.ico\" />\n  </ItemGroup>\n  <ItemGroup>\n    <BootstrapperPackage Include=\".NETFramework,Version=v4.7\">\n      <Visible>False</Visible>\n      <ProductName>Microsoft .NET Framework 4.7 %28x86 and x64%29</ProductName>\n      <Install>true</Install>\n    </BootstrapperPackage>\n    <BootstrapperPackage Include=\"Microsoft.Net.Framework.3.5.SP1\">\n      <Visible>False</Visible>\n      <ProductName>.NET Framework 3.5 SP1</ProductName>\n      <Install>false</Install>\n    </BootstrapperPackage>\n  </ItemGroup>\n  <Import Project=\"$(MSBuildToolsPath)\\Microsoft.CSharp.targets\" />\n  <PropertyGroup>\n    <PostBuildEvent>\n    </PostBuildEvent>\n  </PropertyGroup>\n</Project>"
  },
  {
    "path": "XTR_Toolbox.sln",
    "content": "﻿Microsoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio 15\nVisualStudioVersion = 15.0.27130.2003\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"XTR_Toolbox\", \"XTR_Toolbox\\XTR_Toolbox.csproj\", \"{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}\"\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tDebug|x64 = Debug|x64\n\t\tRelease|Any CPU = Release|Any CPU\n\t\tRelease|x64 = Release|x64\n\t\tDescription = Tool to Optimize Windows\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}.Debug|x64.ActiveCfg = Debug|x64\n\t\t{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}.Debug|x64.Build.0 = Debug|x64\n\t\t{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}.Release|x64.ActiveCfg = Release|x64\n\t\t{B588FFEF-D1D0-4D2B-AE7C-ABB619E50848}.Release|x64.Build.0 = Release|x64\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {1D7B318C-AAA6-4BC6-9214-6B444DAB33AA}\n\tEndGlobalSection\nEndGlobal\n"
  }
]