Someone asked me about this so i post the source:
In short what it does:Code:Sub Main() Dim nHeader As Byte() = {&H44, &H44, &H53, &H20} Dim iDir As String = ".\\" Dim rylClient As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(iDir, FileIO.SearchOption.SearchTopLevelOnly, "Client.exe") If rylClient.Count <> 1 Then Console.WriteLine("Place this tool in your ryl2 directory") Console.WriteLine("") Console.WriteLine("Hit enter to exit") Console.ReadLine() Exit Sub End If Console.WriteLine("Parsing files....") Dim files As System.Collections.ObjectModel.ReadOnlyCollection(Of String) = My.Computer.FileSystem.GetFiles(iDir, FileIO.SearchOption.SearchAllSubDirectories, "*.dds") Console.WriteLine("Number of found files: " & files.Count) Console.WriteLine("") Console.WriteLine("Hit enter to continue or Ctrl+C to exit") Console.ReadLine() Dim changedF As Integer = 0 Console.WriteLine("Editing DDS files... Please wait.") For Each f As String In files Try Dim bw As IO.FileStream = IO.File.Open(f, IO.FileMode.Open, IO.FileAccess.ReadWrite, IO.FileShare.None) 'Dim bb As New IO.BinaryWriter(bw) Dim header(4) As Byte Dim readed As Integer = bw.Read(header, 0, 5) If readed = 5 Then If header(0) = &H0 AndAlso header(1) = &H0 AndAlso header(2) = &H0 AndAlso header(3) = &H0 AndAlso header(4) = &H7C Then Console.WriteLine(f) bw.Seek(0, IO.SeekOrigin.Begin) bw.Write(nHeader, 0, nHeader.Length) bw.Flush() changedF += 1 End If End If bw.Close() Catch ex As Exception Console.WriteLine("Error happened: " & ex.Message) Console.WriteLine() Console.WriteLine("Exiting...") GoTo x End Try Next x: Console.WriteLine("Edited " & changedF & " files. " & (files.Count - changedF) & " files had already DDS header. Hit enter to exit") Console.ReadLine() End Sub
1. Check if client.exe is in the current directory
2. Find all *.dds files in the current and all subdirectorys
3. Check if the header is what gama/youxi changed it to (you may want to disable this one)
4. Write the correct bytes ("DDS ")
5. Save the file



Reply With Quote


