TRS: Difference between revisions

From wowdev
Jump to navigation Jump to search
No edit summary
Line 8: Line 8:


  import java.io.*;
  import java.io.*;
 
  public class trnslate
  public class trnslate
  {
  {
public static String Datei = " "; // .trs-file
  public static String filename = "_bmd5translate.trs";   // .trs-file
public static boolean back = ; // md5 -> clear (false) | clear -> md5 (true)
  public static boolean back = true;                     // md5 -> clear (false) | clear -> md5 (true)
 
 
public static void main(String[] args)  throws IOException
  public static void main(String[] args)  throws IOException
{  
  {
String dir = "";
  String dir = "";
String test[] = new String[5];
  String test[] = new String[5];
File file1 = new File(" ");
  File file1 = new File(" ");
File file2 = new File(" ");
  File file2 = new File(" ");
boolean success = true;
  boolean success = true;
int counter = 0;
  int counter = 0;
int length = 1;
  int length = 1;
File infile = new File(Datei);
  File infile = new File(filename);
FileReader instream = new FileReader(infile);
  FileReader instream = new FileReader(infile);
BufferedReader eingabe = new BufferedReader(instream);
  BufferedReader in = new BufferedReader(instream);
 
while ((eingabe.readLine()) != null)
  while ((in.readLine()) != null)
length++;
    length++;
 
instream = new FileReader(infile);
  instream = new FileReader(infile);
eingabe = new BufferedReader(instream);
  in  = new BufferedReader(instream);
 
String zeile[][] = new String[length][10];
  String zeile[][] = new String[length][10];
String datei[] = new String[length];
  String filename[] = new String[length];
 
while ((datei[counter] = eingabe.readLine()) != null)
  while ((filename[counter] = in.readLine()) != null)
{
  {
if (datei[counter] != null)
    if (filename[counter] != null)
{
    {
test=datei[counter].split("dir: ");
    test=filename[counter].split("dir: ");
if(!(test[0].equals("")))
    if(!(test[0].equals("")))
{
    {
zeile[counter] = datei[counter].split("\t");
      zeile[counter] = filename[counter].split("\t");
     
file1 = new File(zeile[counter][1]);
      file1 = new File(zeile[counter][1]);
file2 = new File(zeile[counter][0]);
      file2 = new File(zeile[counter][0]);
if(back == true)
      if(back == true)
{
      {
file2 = new File(zeile[counter][1]);
      file2 = new File(zeile[counter][1]);
file1 = new File(zeile[counter][0]);
      file1 = new File(zeile[counter][0]);
}
      }
     
success = file1.renameTo(file2);
      success = file1.renameTo(file2);
}
    }
else
    else
{
    {
File temp = new File(test[1]);
      File temp = new File(test[1]);
success = temp.mkdirs();
      success = temp.mkdirs();
}
    }
}
    }  
counter++;
    counter++;
}
  }
}
  }
  }
  }

Revision as of 20:26, 22 July 2007

TRS File

This file is used by World of Warcraft in order to convert texture filename hashcodes into the string that is calling the said texture. There is only one .trs file yet known and it is found in "misc.mpq\textures\Minimap\md5translate.trs" (it is also found in patch.mpq under the same filename). This file is commonly used to convert the minimap texture files in texture.mpq into the hashcode filenames (and vice-versa if needed) in texture.mpq (and patch.mpq).

Simple Translator (Java)

A simple translator, I wrote.

import java.io.*;
public class trnslate
{
 public static String filename = "_bmd5translate.trs";   // .trs-file
 public static boolean back = true;                      // md5 -> clear (false) | clear -> md5 (true)
 
 public static void main(String[] args)  throws IOException
 {
  String dir  = "";
  String test[] = new String[5];
  File file1 = new File(" ");
  File file2 = new File(" ");
  boolean success = true;
  int counter = 0;
  int length = 1;
  File infile = new File(filename);
  FileReader instream = new FileReader(infile);
  BufferedReader in = new BufferedReader(instream);
  
  while ((in.readLine()) != null)
   length++;
  
  instream = new FileReader(infile);
  in  = new BufferedReader(instream);
  
  String zeile[][] = new String[length][10];
  String filename[]  = new String[length];
  
  while ((filename[counter] = in.readLine()) != null)
  {
   if (filename[counter] != null)
   {
    test=filename[counter].split("dir: ");
    if(!(test[0].equals("")))
    {
     zeile[counter] = filename[counter].split("\t");
     
     file1 = new File(zeile[counter][1]);
     file2 = new File(zeile[counter][0]);
     if(back == true)
     {
      file2 = new File(zeile[counter][1]);
      file1 = new File(zeile[counter][0]);
     }
     
     success = file1.renameTo(file2);
    }
    else
    {
     File temp = new File(test[1]);
     success = temp.mkdirs();
    }
   } 
   counter++;
  }
 }
}