PDA

View Full Version : TS4 XML Compare (outdated, now in uploads)


scumbumbo
25th Oct 2014, 4:24 AM
This is outdated - the latest version is now available in the file uploads: http://modthesims.info/download.php?t=570775


This is a simple utility to compare XML files for when a new patch for TS4 gets released. It makes it simple to compare the old versions of the XML to the newer version, only including the files you select from your mod creation folders. It requires that you have an installed copy of WinMerge (http://winmerge.org/) to do the actual comparisons. It is written for the stable version 2.14.0 of WinMerge. It may work with other versions, but that is untested.

As this is an EXE file, I've used my registered copy of WinRAR to make the archive locked and authenticated. The information window (Alt-I in WinRAR) should show that authenticity verification is present and that the archive was created by Rich Gade. If it shows anything else, then the file has been modified by someone else and may contain a virus. You should always check an EXE file even if it's from me though :)

If anyone is interested in the source code, I can make that available as well, but it's nothing all that special or interesting.

Installation is simple, just drop the EXE file in a convenient folder. I put it in the same folder with Sims4XmlExtractor. This was written in Visual Studio 2010, so .NET 4.0 is required. Newer versions of .NET should work as well.

You can use this however works best for you, but here's my process and it seems to work well for me:

BE SURE TO READ THE SAFETY TIP MESSAGE BELOW!
Keep all your XML modifications in a seperate folder for each mod created.
Create an extract folder using Sims4XmlExtractor by velocitygrass (http://modthesims.info/t/534316) for the original XML. I name it 'Extracts-MM-DD-YY' but you can call it anything.
When a new update comes out, create a new extract folder for the updated XML. Make sure you use all the same options for the extract that you used before. It works best if you leave out comments and string tables for the comparison.
Launch TS4 XML Compare. It will automatically try to find the WinMerge executable in the normal installation folder. If it can't find it you will have to browse for it. The location will be saved to a configuration file.
Set the folders for the old and new XML extracts. These folders are also saved in the configuration.
Click the Browse button to select one or more XML files that you want to compare from your mod edit folder. These files are not touched in any way, they are only used to easily select the filenames that will be compared in the extract folders.
Click the Launch button to launch WinMerge to compare all the files.
I find it easiest to have each set of file comparisons open in a new window of WinMerge, however if you prefer to have all the compare windows in one WinMerge window, you can check the box next to the Launch button prior to launching.
Your files in your mod editing folder must be named the same as those in the extract folders.
The XML files from the extracts are opened read-only in WinMerge so they can't be accidentally changed.
Some white space changes in the XML between versions. I find setting the following WinMerge options help for the comparisons, in Options (Compare > General): Whitespace->Ignore all, Ignore blank lines, Ignore case, Ignore cariage return differences, and Enable moved block detection.
There may be bugs, although for the most part some decent testing of assumptions is performed.

v1.1 Updates:

Subfolders of the extract folders are now searched for matching filenames, so you don't have to select the "interaction" or "object" or whatever subfolder, just the top level of the extracts folders.
Added the /xq flag to the WinMerge launch, so files that have no changes will silently close without a prompt. Only XML files that have changed will remain on screen.
Because of the above change, the default (and more useful) option is now to launch all XML files in a single window of WinMerge.
Files not found in the extracts folders will display a message that the file has been skipped rather than trying to launch WinMerge on missing files.


Hope this is useful and my directions make sense. If not, feel free to ask and I can post screenshots or whatever.

scumbumbo
5th Nov 2014, 8:21 AM
VERY IMPORTANT SAFETY TIP

Do NOT do what I just did. I tried to use this on the entire "interactions" folder. Windows choked, puked, and died a horrible BSOD as it tried to launch over 3000 processes of WinMerge! Very painful! Multiple files that were open at the time were corrupted by the crash. :(

Thankfully I have Windows 7 Ultimate and was able to recover the files on the "previous versions" tab in Windows folders properties.

Just use this on a single mod, maybe 50 or so XML files, at a time and you should be fine!

If you want to check a whole folder of the extracts, just use WinMerge by hand and it will run in a single process.

Clarification: You can, of course, use the entire XML extracts in the "OLD" and "NEW" folder fields, just don't put hundreds or thousands of files into the "Your XML File" - each of which launches a new instance of WinMerge.

scumbumbo
15th Jan 2015, 5:29 PM
Just noticed a couple of bugs with the program while checking for required updates for the Jan. 13 patch. Apparantly if you use the "Open all files in one instance of WinMerge" option when checking more than 8 or 10 (don't know the exact number) of XML files it will silently close even though some files don't match up. I suggest turning off that option before checking XML, or at least testing it yourself - perhaps it's just my version of WinMerge that does that.

Also, there's a bug in the program I wrote that isn't saving that option, so the checkmark will reappear the next time you run the utility. I've fixed the bug, so if anyone is still interested I can update the file. Let me know.