Skip to content

Commit

Permalink
Merge pull request #365 from MoscaDotTo/Branch1
Browse files Browse the repository at this point in the history
Update winapp2ool to v1.02
  • Loading branch information
MoscaDotTo authored Jan 30, 2019
2 parents 2490260 + e6a772e commit 8cbc104
Show file tree
Hide file tree
Showing 29 changed files with 957 additions and 733 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@
/winapp2ool/obj/Release/winapp2ool.vbprojAssemblyReference.cache
/winapp2ool/obj/Release/winapp2ool.exe
/winapp2ool/obj/Debug/winapp2ool.exe
/.vs/*
/tools/beta/winapp2.ini
/winapp2ool/bin/Release/winapp2.ini
9 changes: 0 additions & 9 deletions .vs/VSWorkspaceState.json

This file was deleted.

Binary file removed .vs/slnx.sqlite
Binary file not shown.
Binary file removed .vs/winapp2/v16/.suo
Binary file not shown.
1 change: 0 additions & 1 deletion tools/beta/version.txt

This file was deleted.

Binary file removed tools/beta/winapp2ool.exe
Binary file not shown.
6 changes: 3 additions & 3 deletions winapp2ool/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Imports System.Runtime.InteropServices
<Assembly: AssemblyDescription("A multitool for use with winapp2.ini")>
<Assembly: AssemblyCompany("https://github.com/MoscaDotTo/Winapp2")>
<Assembly: AssemblyProduct("winapp2ool")>
<Assembly: AssemblyCopyright("Copyright © 2018")>
<Assembly: AssemblyCopyright("Robbie Ward © 2018-2019")>
<Assembly: AssemblyTrademark("")>

<Assembly: ComVisible(False)>
Expand All @@ -32,6 +32,6 @@ Imports System.Runtime.InteropServices
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: AssemblyVersion("1.0.2.0")>
<Assembly: AssemblyFileVersion("1.0.2.0")>
<Assembly: NeutralResourcesLanguage("")>
38 changes: 20 additions & 18 deletions winapp2ool/Readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Winapp2ool

Winapp2ool is a small but robust application designed to take the busy work out of maintaining, managing, downloading, and deploying winapp2.ini. It is designed for use with a network connection, but many functions will work without one by acting on local files.
Expand Down Expand Up @@ -26,7 +25,7 @@ Winapp2ool supports command line switches. There are several top level switches

### Valid commandline args & their effects:

* `1,2,3,4,5,6`,`-1,-2,-3,-4,-5,-6`: Calls the module associated with the menu number in the winapp2ool menu. 1 for WinappDebug, 6 for Downloader. All other commands should follow this one.
* `1,2,3,4,5,6`,`debug,trim,merge,diff,ccdebug,download`: Calls the module associated with the menu number in the winapp2ool menu. 1 for WinappDebug, 6 for Downloader. All other commands should follow this one. Use of a `-` before each flag is not required here, but is supported.
* `-s`: Actives "silent mode" muting most or all output from the application. When silent mode is active, programs will silently fail if they hit an error during execution. The application will automatically exit after it has finished its task.
* `-1f`, `-1d`: Defines a new file name or path for winapp2.ini to be used during module execution. You can define subdirectories of the current directory easily with the `-f` flag by simply prepending the directory to the file name. eg: `-1f \subdir\winapp2.ini`. File and directory parameters should always immediately follow their flag.
* `-2f`,`-2d`: As above, defines the target for the "second file" in program execution, which is more specifically addressed in the module documentation below.
Expand All @@ -35,8 +34,8 @@ Winapp2ool supports command line switches. There are several top level switches
#### Example:

`winapp2ool.exe -1 -c`: Opens winapp2ool and runs WinappDebug with the autocorrect option enabled.
`winapp2ool.exe -2 -d -s`: Silents opens winapp2ool, downloads the latest winapp2.ini, and trims it.

`winapp2ool.exe -2 -d -s`: Silently opens winapp2ool, downloads the latest winapp2.ini, and trims it.
`winapp2ool download winapp2 -s` Silently opens winapp2ool and downloads the latest winapp2.ini
### Menu Options

* WinappDebug, Trim, Merge, Diff, CCiniDebug, Downloader
Expand Down Expand Up @@ -195,14 +194,14 @@ Trim is designed to do as its name implies: trim winapp2.ini. It does this by pr

* Toggle Download
* Enables/Disables downloading of the latest winapp2.ini from GitHub to use as the input for the trimmer
* Most users will want to select this option
* Disabled by default
* Enabled by default if you have an internet connection
* Unavailable in offline mode

* Toggle Download (non-CCleaner)
* Only shown when downloading is enabled first
* Toggle Download (Non-CCleaner)
* Toggles downloading the Non-CCleaner winapp2.ini
* CCleaner users should not use this option
* Disabled by default
* Unavailable if downloading is disabled
* Unavailable in offline mode

* File Chooser (winapp2.ini)
Expand Down Expand Up @@ -230,6 +229,7 @@ This tool is designed to simply merge two local ini files. It has two modes, bot
* `-r`: Uses "Removed Entries.ini" as the merge file name
* `-c`: Uses "custom.ini" as the merge file name
* `-w`: Uses "winapp3.ini" as the merge file name
* `-a`: Uses "archived entries.ini" as the merge file name
* `-3f`,`-3d`: Overrides the default save path for the merged file
* `-mm`: Switches the Merge Mode from Add&Replace to Add&Remove

Expand Down Expand Up @@ -293,13 +293,12 @@ This tool is designed to simply merge two local ini files. It has two modes, bot

* Winapp2.ini (online)
* Enables downloading the latest copy of winapp2.ini from GitHub to use as the comparator file
* Most users will want to select this option

* Winapp2.ini (non-CCleaner)
* Enables downloading the latest non-CCleaner variant of winapp2.ini to use as the comparator file
* CCleaner users should not use this option
* Only shown if winapp2.ini (online) option is enabled
* Enabled by default if you have an internet connection

* winapp2.ini (Non-CCleaner)
* Enables downloading the latest Non-CCleaner variant of winapp2.ini to use as the comparator file
* CCleaner users should not use this option
* Unavailable if downloading winapp2.ini is not enabled
* Toggle Log Saving
* Enables or disables saving the diff output to a file at the end of execution
* Default log name is diff.txt
Expand Down Expand Up @@ -370,11 +369,14 @@ This tool was born of necessity in the advent of a mass renaming of entries in w
## Downloader

### Valid commandline args & their effects:
* `1`: Downloads winapp2.ini
* `1` or `winapp2`: Downloads winapp2.ini
* `2`: Downloads the non-CCleaner winapp2.ini
* `3`: Downloads winapp2ool.exe
* `4`: Downloads Removed Entries.ini
* `5`: Downloads winapp3.ini
* `3`or `winapp2ool`: Downloads winapp2ool.exe
* `4`or `removed`: Downloads Removed Entries.ini
* `5`or `winapp3`: Downloads winapp3.ini
* `6`or `archived`: Downloads Archived Entries.ini
* `7`or `java`: Downloads java.ini
* `8`or `readme`: Downloads the winapp2ool readme

### Menu Options

Expand Down
10 changes: 6 additions & 4 deletions winapp2ool/Winapp2ool.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
' Copyright (C) 2018 Robbie Ward
' Copyright (C) 2018-2019 Robbie Ward
'
' This file is a part of Winapp2ool
'
Expand All @@ -20,7 +20,7 @@ Imports Microsoft.Win32

Module Winapp2ool
' Update and compatibility settings
Public currentVersion As String = "1.0"
Public currentVersion As String = "1.02"
Dim latestVersion As String = ""
Dim latestWa2Ver As String = ""
Dim localWa2Ver As String = ""
Expand Down Expand Up @@ -137,12 +137,14 @@ Module Winapp2ool
Case input = "9" And waUpdateIsAvail
Console.Clear()
Console.Write("Downloading & diffing, this may take a moment...")
remoteDiff(lwinapp2File, eini, eini, True, False, False)
remoteDiff(lwinapp2File)
undoAnyPendingExits()
menuHeaderText = "Diff Complete"
Case (input = "10" And (updateIsAvail And waUpdateIsAvail)) Or (input = "7" And (Not waUpdateIsAvail And updateIsAvail)) And Not dnfOOD
Console.WriteLine("Downloading and updating winapp2ool.exe, this may take a moment...")
autoUpdate()
Case input.ToLower = "m"
initModule("Minefield", AddressOf Minefield.printMenu, AddressOf Minefield.handleUserInput)
Case Else
menuHeaderText = invInpStr
End Select
Expand Down Expand Up @@ -243,7 +245,7 @@ Module Winapp2ool
End If
Dim osVersion As String = System.Environment.OSVersion.ToString().Replace("Microsoft Windows NT ", "")
Dim ver As String() = osVersion.Split(CChar("."))
Dim out As Double = CDbl($"{ver(0)}.{ver(1)}")
Dim out As Double = Val($"{ver(0)}.{ver(1)}")
' This might not act completely correctly on Windows 8.1 but usage of that seems small enough that it wont be an issue
If Not {5.1, 6.0, 6.1, 6.2, 6.3}.Contains(out) Then
Console.WriteLine("Unable to determine which version of Windows you are running.")
Expand Down
Binary file modified winapp2ool/bin/Debug/winapp2ool.exe
Binary file not shown.
Binary file modified winapp2ool/bin/Release/winapp2ool.exe
Binary file not shown.
61 changes: 15 additions & 46 deletions winapp2ool/components/CCiniDebug.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
' Copyright (C) 2018 Robbie Ward
' Copyright (C) 2018-2019 Robbie Ward
'
' This file is a part of Winapp2ool
'
Expand Down Expand Up @@ -45,40 +45,18 @@ Module CCiniDebug
End Sub

''' <summary>
''' Initializes the default module settings and returns references to them to the calling function
''' Handles the commandline args for CCiniDebug
''' </summary>
''' <param name="firstFile">The iniFile object to represent winapp2.ini</param>
''' <param name="secondFile">The iniFile object to represent ccleaner.ini</param>
''' <param name="thirdFile">The iniFile object containing the save path information</param>
''' <param name="pf">The boolean for pruning</param>
''' <param name="sa">The boolean for saving</param>
''' <param name="so">The boolean for sorting</param>
Public Sub initCCDebugParams(ByRef firstFile As iniFile, ByRef secondFile As iniFile, ByRef thirdFile As iniFile, ByRef pf As Boolean, ByRef sa As Boolean, ByRef so As Boolean)
''' CCiniDebug args:
''' -noprune : disable pruning of stale winapp2.ini entries
''' -nosort : disable sorting ccleaner.ini alphabetically
''' -nosave : disable saving the modified ccleaner.ini back to file
Public Sub handleCmdlineArgs()
initDefaultSettings()
firstFile = winappFile
secondFile = ccFile
thirdFile = outputFile
pf = pruneFile
sa = saveFile
so = sortFile
End Sub

''' <summary>
''' Runs the debugger when called from outside the module
''' </summary>
''' <param name="firstfile">The winapp2.ini iniFile</param>
''' <param name="secondfile">The ccleaner.ini iniFile</param>
''' <param name="thirdfile">The iniFile with the save location</param>
''' <param name="pf">Boolean for pruning</param>
''' <param name="sa">Boolean for saving</param>
''' <param name="so">Boolean for sorting</param>
Public Sub remoteCC(firstfile As iniFile, secondfile As iniFile, thirdfile As iniFile, pf As Boolean, sa As Boolean, so As Boolean)
winappFile = firstfile
ccFile = secondfile
outputFile = thirdfile
pruneFile = pf
saveFile = sa
sortFile = so
invertSettingAndRemoveArg(pruneFile, "-noprune")
invertSettingAndRemoveArg(sortFile, "-nosort")
invertSettingAndRemoveArg(saveFile, "-nosave")
getFileAndDirParams(winappFile, ccFile, outputFile)
initDebug()
End Sub

Expand Down Expand Up @@ -107,7 +85,7 @@ Module CCiniDebug
Public Sub handleUserInput(input As String)
Select Case True
Case input = "0"
exitModule("CCiniDebug")
exitModule()
Case (input = "1" Or input = "") And (pruneFile Or saveFile Or sortFile)
initDebug()
Case input = "2"
Expand Down Expand Up @@ -159,7 +137,8 @@ Module CCiniDebug
Dim optionStr As String = optionsSec.keys.Values(i).toString
' Only operate on (app) keys belonging to winapp2.ini
If optionStr.StartsWith("(App)") And optionStr.Contains("*") Then
trimStrs({"(App)", "=True", "=False"}, optionStr)
Dim toRemove As New List(Of String) From {"(App)", "=True", "=False"}
toRemove.ForEach(Sub(param) optionStr = optionStr.Replace(param, ""))
If Not winappFile.sections.ContainsKey(optionStr) Then
printMenuLine(optionsSec.keys.Values(i).toString)
tbTrimmed.Add(optionsSec.keys.Keys(i))
Expand All @@ -170,22 +149,12 @@ Module CCiniDebug
optionsSec.removeKeys(tbTrimmed)
End Sub

''' <summary>
''' Removes any instance of the provided strings from a string and returns what's left
''' </summary>
''' <param name="toRemove">The array of strings to be removed</param>
''' <param name="inputTxt">The given string to be modified</param>
Private Sub trimStrs(toRemove As String(), ByRef inputTxt As String)
For Each param In toRemove
inputTxt = inputTxt.Replace(param, "")
Next
End Sub

''' <summary>
''' Sorts the keys in the Options (only) section of ccleaner.ini
''' </summary>
Private Sub sortCC()
Dim lineList As List(Of String) = ccFile.sections("Options").getKeysAsList
lineList.Sort()
lineList.Insert(0, "[Options]")
ccFile.sections("Options") = New iniSection(lineList)
End Sub
Expand Down
Loading

0 comments on commit 8cbc104

Please sign in to comment.