Upvote Upvoted 18 Downvote Downvoted
TF2 / Steam Cfg? Comparing Tool v1.0
1
#1
0 Frags +

So as some may have seen I posted an image of a GUI that I was working on that would compare to configs. I have completed the GUI and the backbone of the code to compare the two I just haven't thrown them together. I will do this soon. But I wanted to get the comparing tool out there and have people test it with various configs and what have you to make sure its working correctly.

Here is what the finished GUI will look like

https://i.imgur.com/OpIJHvl.png

Here is a YouTube Demo

https://www.youtube.com/watch?v=mWXwzjh2Pag

Download Link

What the parser does is:

First you are asked to open the first Cfg and then the second (In the final project you can do it straight from clipboard as shown in the image above)

1: Removes All Comments
2: Remove All Spaces
3: Removes All "
4: Removes All '
5: Split Commands/Variables
6: Puts Commands/Variables back together all in same format: command "variable"
7: Finds all unique convars in Cfg A
8: Finds all unique convars in Cfg B
9: Finds duplicate convars between Cfg A + B
10: Outputs it in three different windows (This will of course all go into the GUI window)

First window = Cfg's A unique convars
Second window = Cfg's B unique convars
Third window = duplicates

The source is located here

Show Content
[code]
#include <Array.au3>
#include <File.au3>

Dim $CfgACommands[0], $CfgBCommands[0], $CfgAUnique[0], $CfgBUnique[0], $SameCommands[0]
Global $ReadCfgA, $ReadCfgB, $FoundComments = 0, $String, $Found = 0

$CfgA = FileOpenDialog("Cfg A", @DesktopDir, "All(*.*)")
$CfgB = FileOpenDialog("Cfg B", @DesktopDir, "All(*.*)")

_FileReadToArray($CfgA, $ReadCfgA)
_FileReadToArray($CfgB, $ReadCfgB)

For $i = 1 To UBound($ReadCfgA) - 1
$Null = 0
$FoundComments = 0
$ReadCfgA[$i] = StringStripWS($ReadCfgA[$i], 8)
$ReadCfgA[$i] = StringReplace($ReadCfgA[$i], "'", "")
$ReadCfgA[$i] = StringReplace($ReadCfgA[$i], '"', "")
If StringInStr($ReadCfgA[$i], "//") Then
$RemoveComments = StringSplit($ReadCfgA[$i], "//")
$FoundComments = 1
Else
$String = $ReadCfgA[$i]
EndIf

If $FoundComments = 1 Then
$String = $RemoveComments[1]
EndIf

If StringLen($String) < 1 Then
$Null = 1
EndIf

If $Null = 0 Then

$GetLen = StringLen($String)
$Count = 0
$Null = 1
For $a = 1 To $GetLen
$Trim = StringTrimLeft($String, $a)
If StringIsDigit($Trim) Then
$Count = $a
$Null = 0
ExitLoop
EndIf
Next

If $Null = 0 Then

$Variable = StringTrimLeft($String, $Count)
$GetLen = StringLen($Variable)
$Command = StringTrimRight($String, $GetLen)

If StringInStr($Command, ".") Then
$Command = StringReplace($Command, ".", "")
$GetLen = StringLen($Command)
$TrimOffNumbers = StringTrimLeft($Command, $GetLen - 1)
If StringIsDigit($TrimOffNumbers) Then
$Command = StringTrimRight($Command, 1)
$Variable = $TrimOffNumbers & "." & $Variable
Else
$Variable = "." & $Variable
EndIf
EndIf

If StringInStr($Command, "-") Then
$Command = StringTrimRight($Command, 1)
$Variable = "-" & $Variable
EndIf

$String = $Command & " " & '"' & $Variable & '"'

_ArrayAdd($CfgACommands, $String)
EndIf
EndIf

Next

For $i = 1 To UBound($ReadCfgB) - 1
$Null = 0
$FoundComments = 0
$ReadCfgB[$i] = StringStripWS($ReadCfgB[$i], 8)
$ReadCfgB[$i] = StringReplace($ReadCfgB[$i], "'", "")
$ReadCfgB[$i] = StringReplace($ReadCfgB[$i], '"', "")
If StringInStr($ReadCfgB[$i], "//") Then
$RemoveComments = StringSplit($ReadCfgB[$i], "//")
$FoundComments = 1
Else
$String = $ReadCfgB[$i]
EndIf

If $FoundComments = 1 Then
$String = $RemoveComments[1]
EndIf

If StringLen($String) < 1 Then
$Null = 1
EndIf

If $Null = 0 Then

$GetLen = StringLen($String)
$Count = 0
$Null = 1
For $a = 1 To $GetLen
$Trim = StringTrimLeft($String, $a)
If StringIsDigit($Trim) Then
$Count = $a
$Null = 0
ExitLoop
EndIf
Next

If $Null = 0 Then

$Variable = StringTrimLeft($String, $Count)
$GetLen = StringLen($Variable)
$Command = StringTrimRight($String, $GetLen)

If StringInStr($Command, ".") Then
$Command = StringReplace($Command, ".", "")
$GetLen = StringLen($Command)
$TrimOffNumbers = StringTrimLeft($Command, $GetLen - 1)
If StringIsDigit($TrimOffNumbers) Then
$Command = StringTrimRight($Command, 1)
$Variable = $TrimOffNumbers & "." & $Variable
Else
$Variable = "." & $Variable
EndIf
EndIf

If StringInStr($Command, "-") Then
$Command = StringTrimRight($Command, 1)
$Variable = "-" & $Variable
EndIf

$String = $Command & " " & '"' & $Variable & '"'

_ArrayAdd($CfgBCommands, $String)
EndIf
EndIf

Next

$CheckLen1 = UBound($CfgACommands)
$CheckLen2 = UBound($CfgBCommands)

If $CheckLen1 > $CheckLen2 Then
$Length = 1
Else
$Length = 2
EndIf

If $Length = 2 Then
For $a = 0 To UBound($CfgACommands) - 1
$CheckString = $CfgACommands[$a]
For $b = 0 To UBound($CfgBCommands) - 1
If $CheckString = $CfgBCommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 0 Then
_ArrayAdd($CfgAUnique, $CheckString)
EndIf
$Found = 0
Next

For $a = 0 To UBound($CfgACommands) - 1
If $a > UBound($CfgBCommands) - 1 Then
ExitLoop
EndIf
$CheckString = $CfgBCommands[$a]
For $b = 0 To UBound($CfgACommands) - 1
If $CheckString = $CfgACommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 0 Then
_ArrayAdd($CfgBUnique, $CheckString)
EndIf
$Found = 0
Next

For $a = 0 To UBound($CfgACommands) - 1
If $a > UBound($CfgBCommands) - 1 Then
ExitLoop
EndIf
$CheckString = $CfgACommands[$a]
For $b = 0 To UBound($CfgBCommands) - 1
If $CheckString = $CfgBCommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 1 Then
_ArrayAdd($SameCommands, $CheckString)
EndIf
$Found = 0
Next

EndIf

If $Length = 1 Then
For $a = 0 To UBound($CfgBCommands) - 1
$CheckString = $CfgACommands[$a]
For $b = 0 To UBound($CfgBCommands) - 1
If $CheckString = $CfgBCommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 0 Then
_ArrayAdd($CfgAUnique, $CheckString)
EndIf
$Found = 0
Next

For $a = 0 To UBound($CfgBCommands) - 1
If $a > UBound($CfgACommands) - 1 Then
ExitLoop
EndIf
$CheckString = $CfgBCommands[$a]
For $b = 0 To UBound($CfgACommands) - 1
If $CheckString = $CfgACommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 0 Then
_ArrayAdd($CfgBUnique, $CheckString)
EndIf
$Found = 0
Next

For $a = 0 To UBound($CfgBCommands) - 1
If $a > UBound($CfgACommands) - 1 Then
ExitLoop
EndIf
$CheckString = $CfgBCommands[$a]
For $b = 0 To UBound($CfgACommands) - 1
If $CheckString = $CfgACommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 1 Then
_ArrayAdd($SameCommands, $CheckString)
EndIf
$Found = 0
Next

EndIf

_ArrayDisplay($CfgAUnique)
_ArrayDisplay($CfgBUnique)
_ArrayDisplay($SameCommands)[/code]
So as some may have seen I posted an image of a GUI that I was working on that would compare to configs. I have completed the GUI and the backbone of the code to compare the two I just haven't thrown them together. I will do this soon. But I wanted to get the comparing tool out there and have people test it with various configs and what have you to make sure its working correctly.

Here is what the finished GUI will look like
[img]https://i.imgur.com/OpIJHvl.png[/img]

Here is a YouTube Demo
[youtube]https://www.youtube.com/watch?v=mWXwzjh2Pag[/youtube]


[url=https://github.com/Tf2Prophete/Cfg-Compare]Download Link[/url]


What the parser does is:

First you are asked to open the first Cfg and then the second (In the final project you can do it straight from clipboard as shown in the image above)

1: Removes All Comments
2: Remove All Spaces
3: Removes All "
4: Removes All '
5: Split Commands/Variables
6: Puts Commands/Variables back together all in same format: command "variable"
7: Finds all unique convars in Cfg A
8: Finds all unique convars in Cfg B
9: Finds duplicate convars between Cfg A + B
10: Outputs it in three different windows (This will of course all go into the GUI window)

First window = Cfg's A unique convars
Second window = Cfg's B unique convars
Third window = duplicates

The source is located here

[spoiler]
[code]
#include <Array.au3>
#include <File.au3>

Dim $CfgACommands[0], $CfgBCommands[0], $CfgAUnique[0], $CfgBUnique[0], $SameCommands[0]
Global $ReadCfgA, $ReadCfgB, $FoundComments = 0, $String, $Found = 0

$CfgA = FileOpenDialog("Cfg A", @DesktopDir, "All(*.*)")
$CfgB = FileOpenDialog("Cfg B", @DesktopDir, "All(*.*)")

_FileReadToArray($CfgA, $ReadCfgA)
_FileReadToArray($CfgB, $ReadCfgB)

For $i = 1 To UBound($ReadCfgA) - 1
$Null = 0
$FoundComments = 0
$ReadCfgA[$i] = StringStripWS($ReadCfgA[$i], 8)
$ReadCfgA[$i] = StringReplace($ReadCfgA[$i], "'", "")
$ReadCfgA[$i] = StringReplace($ReadCfgA[$i], '"', "")
If StringInStr($ReadCfgA[$i], "//") Then
$RemoveComments = StringSplit($ReadCfgA[$i], "//")
$FoundComments = 1
Else
$String = $ReadCfgA[$i]
EndIf

If $FoundComments = 1 Then
$String = $RemoveComments[1]
EndIf

If StringLen($String) < 1 Then
$Null = 1
EndIf

If $Null = 0 Then

$GetLen = StringLen($String)
$Count = 0
$Null = 1
For $a = 1 To $GetLen
$Trim = StringTrimLeft($String, $a)
If StringIsDigit($Trim) Then
$Count = $a
$Null = 0
ExitLoop
EndIf
Next

If $Null = 0 Then

$Variable = StringTrimLeft($String, $Count)
$GetLen = StringLen($Variable)
$Command = StringTrimRight($String, $GetLen)

If StringInStr($Command, ".") Then
$Command = StringReplace($Command, ".", "")
$GetLen = StringLen($Command)
$TrimOffNumbers = StringTrimLeft($Command, $GetLen - 1)
If StringIsDigit($TrimOffNumbers) Then
$Command = StringTrimRight($Command, 1)
$Variable = $TrimOffNumbers & "." & $Variable
Else
$Variable = "." & $Variable
EndIf
EndIf

If StringInStr($Command, "-") Then
$Command = StringTrimRight($Command, 1)
$Variable = "-" & $Variable
EndIf

$String = $Command & " " & '"' & $Variable & '"'

_ArrayAdd($CfgACommands, $String)
EndIf
EndIf

Next

For $i = 1 To UBound($ReadCfgB) - 1
$Null = 0
$FoundComments = 0
$ReadCfgB[$i] = StringStripWS($ReadCfgB[$i], 8)
$ReadCfgB[$i] = StringReplace($ReadCfgB[$i], "'", "")
$ReadCfgB[$i] = StringReplace($ReadCfgB[$i], '"', "")
If StringInStr($ReadCfgB[$i], "//") Then
$RemoveComments = StringSplit($ReadCfgB[$i], "//")
$FoundComments = 1
Else
$String = $ReadCfgB[$i]
EndIf

If $FoundComments = 1 Then
$String = $RemoveComments[1]
EndIf

If StringLen($String) < 1 Then
$Null = 1
EndIf

If $Null = 0 Then

$GetLen = StringLen($String)
$Count = 0
$Null = 1
For $a = 1 To $GetLen
$Trim = StringTrimLeft($String, $a)
If StringIsDigit($Trim) Then
$Count = $a
$Null = 0
ExitLoop
EndIf
Next

If $Null = 0 Then

$Variable = StringTrimLeft($String, $Count)
$GetLen = StringLen($Variable)
$Command = StringTrimRight($String, $GetLen)

If StringInStr($Command, ".") Then
$Command = StringReplace($Command, ".", "")
$GetLen = StringLen($Command)
$TrimOffNumbers = StringTrimLeft($Command, $GetLen - 1)
If StringIsDigit($TrimOffNumbers) Then
$Command = StringTrimRight($Command, 1)
$Variable = $TrimOffNumbers & "." & $Variable
Else
$Variable = "." & $Variable
EndIf
EndIf

If StringInStr($Command, "-") Then
$Command = StringTrimRight($Command, 1)
$Variable = "-" & $Variable
EndIf

$String = $Command & " " & '"' & $Variable & '"'

_ArrayAdd($CfgBCommands, $String)
EndIf
EndIf

Next

$CheckLen1 = UBound($CfgACommands)
$CheckLen2 = UBound($CfgBCommands)

If $CheckLen1 > $CheckLen2 Then
$Length = 1
Else
$Length = 2
EndIf

If $Length = 2 Then
For $a = 0 To UBound($CfgACommands) - 1
$CheckString = $CfgACommands[$a]
For $b = 0 To UBound($CfgBCommands) - 1
If $CheckString = $CfgBCommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 0 Then
_ArrayAdd($CfgAUnique, $CheckString)
EndIf
$Found = 0
Next

For $a = 0 To UBound($CfgACommands) - 1
If $a > UBound($CfgBCommands) - 1 Then
ExitLoop
EndIf
$CheckString = $CfgBCommands[$a]
For $b = 0 To UBound($CfgACommands) - 1
If $CheckString = $CfgACommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 0 Then
_ArrayAdd($CfgBUnique, $CheckString)
EndIf
$Found = 0
Next

For $a = 0 To UBound($CfgACommands) - 1
If $a > UBound($CfgBCommands) - 1 Then
ExitLoop
EndIf
$CheckString = $CfgACommands[$a]
For $b = 0 To UBound($CfgBCommands) - 1
If $CheckString = $CfgBCommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 1 Then
_ArrayAdd($SameCommands, $CheckString)
EndIf
$Found = 0
Next

EndIf

If $Length = 1 Then
For $a = 0 To UBound($CfgBCommands) - 1
$CheckString = $CfgACommands[$a]
For $b = 0 To UBound($CfgBCommands) - 1
If $CheckString = $CfgBCommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 0 Then
_ArrayAdd($CfgAUnique, $CheckString)
EndIf
$Found = 0
Next

For $a = 0 To UBound($CfgBCommands) - 1
If $a > UBound($CfgACommands) - 1 Then
ExitLoop
EndIf
$CheckString = $CfgBCommands[$a]
For $b = 0 To UBound($CfgACommands) - 1
If $CheckString = $CfgACommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 0 Then
_ArrayAdd($CfgBUnique, $CheckString)
EndIf
$Found = 0
Next

For $a = 0 To UBound($CfgBCommands) - 1
If $a > UBound($CfgACommands) - 1 Then
ExitLoop
EndIf
$CheckString = $CfgBCommands[$a]
For $b = 0 To UBound($CfgACommands) - 1
If $CheckString = $CfgACommands[$b] Then
$Found = 1
EndIf
Next
If $Found = 1 Then
_ArrayAdd($SameCommands, $CheckString)
EndIf
$Found = 0
Next

EndIf

_ArrayDisplay($CfgAUnique)
_ArrayDisplay($CfgBUnique)
_ArrayDisplay($SameCommands)[/code][/spoiler]
2
#2
9 Frags +

This is cool! Have the gui add [*] to all convars that no longer work in matchmaking :^)

-source in spoiler pls-

This is cool! Have the gui add [*] to all convars that no longer work in matchmaking :^)

-source in spoiler pls-
3
#3
3 Frags +

Get me a list of em and I can :)

Get me a list of em and I can :)
4
#4
0 Frags +

Current Fixes Already Worked Out / Not Released:

Alias (bindings) are now removed since they are only preference and don't matter when comparing cfgs
Echo (say in console) are now removed since they are only preference and don't matter when comparing cfgs

Current Fixes Already Worked Out / Not Released:

Alias (bindings) are now removed since they are only preference and don't matter when comparing cfgs
Echo (say in console) are now removed since they are only preference and don't matter when comparing cfgs
5
#5
1 Frags +

Demo of the upcoming final project

Also in OP now.

https://www.youtube.com/watch?v=mWXwzjh2Pag

Demo of the upcoming final project

Also in OP now.

[youtube]https://www.youtube.com/watch?v=mWXwzjh2Pag[/youtube]
6
#6
3 Frags +

I believe it is now done. If anyone has any problems with the comparing (A cfg not working or anything) please let me know!

Here is the Github, also in the OP now.

GitHub

I believe it is now done. If anyone has any problems with the comparing (A cfg not working or anything) please let me know!

Here is the Github, also in the OP now.

[url=https://github.com/Tf2Prophete/Cfg-Compare]GitHub[/url]
Please sign in through STEAM to post a comment.