com.kirkwarez.cheezefix
Class CheezeFix

java.lang.Object
  extended by com.kirkwarez.cheezefix.CheezeFix

public class CheezeFix
extends java.lang.Object

This class can fix wiremod MDL files by cheeze, which fixes the console error spam.

Since:
1.00
Version:
1.00
Author:
Berend "Kirk" Wouda

Field Summary
protected  boolean backup
          Whether or not to back up files before they are fixed.
static java.util.regex.Pattern cheezePattern
          The pattern of the mdlkeyvalue section in cheeze's MDL files.
protected  int fixedMDLCount
          The amount of MDL files fixed.
static java.util.regex.Pattern mkvPattern
          The pattern of the mdlkeyvalue section.
protected  int skippedMDLCount
          The amount of MDL files skipped.
protected  int skippedNonExistingCount
          The amount of non-existing files skipped.
protected  int skippedNonMDLCount
          The amount of non-MDL files skipped.
 
Constructor Summary
CheezeFix(boolean backup)
          Constructs a new CheezeFix.
 
Method Summary
 void fix(java.io.File file)
          Fixes the given file or the contents of the given directory (recursively).
protected  byte[] fixData(byte[] data)
          Inspects the given data, and fixes it if possible.
protected  void fixDir(java.io.File dir)
          Fixes the contents of the given directory (recursively).
protected  void fixFile(java.io.File file)
          Fixes the given file.
 int getFixedMDLCount()
          Returns the fixed MDL files count.
 int getSkippedMDLCount()
          Returns the skipped MDL files count.
 int getSkippedNonExistingCount()
          Returns the skipped non-existing files count.
 int getSkippedNonMDLCount()
          Returns the skipped non-MDL files count.
static void main(java.lang.String[] args)
          Fixes the given wiremod MDL files by cheeze, which fixes the console error spam.
protected  byte[] readFile(java.io.File file)
          Reads a file into an array.
protected  void writeFile(java.io.File file, byte[] data)
          Writes an array into a file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

backup

protected boolean backup
Whether or not to back up files before they are fixed.


fixedMDLCount

protected int fixedMDLCount
The amount of MDL files fixed.


skippedMDLCount

protected int skippedMDLCount
The amount of MDL files skipped.


skippedNonMDLCount

protected int skippedNonMDLCount
The amount of non-MDL files skipped.


skippedNonExistingCount

protected int skippedNonExistingCount
The amount of non-existing files skipped.


mkvPattern

public static java.util.regex.Pattern mkvPattern
The pattern of the mdlkeyvalue section.


cheezePattern

public static java.util.regex.Pattern cheezePattern
The pattern of the mdlkeyvalue section in cheeze's MDL files.

Constructor Detail

CheezeFix

public CheezeFix(boolean backup)
Constructs a new CheezeFix.

Parameters:
backup - Whether or not to back up files before they are fixed.
Method Detail

fix

public void fix(java.io.File file)
Fixes the given file or the contents of the given directory (recursively).

Parameters:
file - The file to fix, or the directory to fix the contents of.

fixDir

protected void fixDir(java.io.File dir)
Fixes the contents of the given directory (recursively).

Parameters:
dir - The directory to fix the contents of.

fixFile

protected void fixFile(java.io.File file)
Fixes the given file.

Parameters:
file - The file to fix.

readFile

protected byte[] readFile(java.io.File file)
                   throws java.io.IOException
Reads a file into an array.

Parameters:
file - The file to read.
Returns:
The read data.
Throws:
java.io.IOException - If a reading error occurs.

writeFile

protected void writeFile(java.io.File file,
                         byte[] data)
                  throws java.io.IOException
Writes an array into a file.

Parameters:
file - The file to write to.
data - The data to write.
Throws:
java.io.IOException - If a writing error occurs.

fixData

protected byte[] fixData(byte[] data)
Inspects the given data, and fixes it if possible.

Parameters:
data - The data to fix.
Returns:
The fixed data, or null if the data is fine or could not be fixed.

getFixedMDLCount

public int getFixedMDLCount()
Returns the fixed MDL files count.

Returns:
The fixed MDL files count.

getSkippedMDLCount

public int getSkippedMDLCount()
Returns the skipped MDL files count.

Returns:
The skipped MDL files count.

getSkippedNonMDLCount

public int getSkippedNonMDLCount()
Returns the skipped non-MDL files count.

Returns:
The skipped non-MDL files count.

getSkippedNonExistingCount

public int getSkippedNonExistingCount()
Returns the skipped non-existing files count.

Returns:
The skipped non-existing files count.

main

public static void main(java.lang.String[] args)
Fixes the given wiremod MDL files by cheeze, which fixes the console error spam.

Parameters:
args - The commandline parameters, which should be files and directories.