Advertisement
Guest User

Prekladac

a guest
Mar 29th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.85 KB | None | 0 0
  1. Dim reader As StreamReader = My.Computer.FileSystem.OpenTextFileReader("c:\Users\user\Downloads\Game.Dev.Tycoon.v1.6.15\Game.Dev.Tycoon.v1.6.15\compressed\codeNw_orig.js")
  2.         Dim fileReader As String
  3.  
  4.         Dim out As String = ""
  5.         Dim tmp_out As String = ""
  6.         Dim orig As String = ""
  7.  
  8.         Dim original As String
  9.         Dim preklad As String
  10.  
  11.         Dim counter As Integer
  12.  
  13.  
  14.         Dim orig_counter As Integer
  15.  
  16.         Dim readercs As StreamReader = My.Computer.FileSystem.OpenTextFileReader("c:\Users\user\Downloads\Game.Dev.Tycoon.v1.6.15\Game.Dev.Tycoon.v1.6.15\compressed\preklad_cs.txt")
  17.  
  18.         Dim idx(5) As Integer
  19.  
  20.         Do
  21.             fileReader = reader.ReadLine
  22.             tmp_out = ""
  23.  
  24.             If fileReader Is Nothing = False Then
  25.  
  26.                 REM Console.WriteLine("Line:" & fileReader)
  27.  
  28.                 If fileReader.Contains(""".localize") Then
  29.                     Dim result As String() = fileReader.Split(New String() {".localize"}, StringSplitOptions.None)
  30.  
  31.                     REM Console.WriteLine(result.Length)
  32.                     counter = 0
  33.  
  34.                     For Each s As String In result
  35.                         REM Console.WriteLine("Split:" & s)
  36.  
  37.                         counter = counter + 1
  38.  
  39.                         For i = 0 To s.Length - 1
  40.  
  41.                             If s(i) = Chr(34) Then
  42.                                 idx(1) = idx(0)
  43.                                 idx(0) = i
  44.                             End If
  45.  
  46.                         Next
  47.  
  48.                         If s.EndsWith(Chr(34)) And counter <> result.Length Then
  49.                             REM Console.WriteLine("Nasel:" & s)
  50.                             REM Console.WriteLine("Orig:" & s.Substring(idx(1) + 1, idx(0) - idx(1) - 1))
  51.  
  52.                             original = s.Substring(idx(1) + 1, idx(0) - idx(1) - 1)
  53.                             preklad = readercs.ReadLine
  54.  
  55.  
  56.                             s = s.Replace(original, preklad)
  57.                             Console.WriteLine("Orig:" & original & "   Preklad:" & preklad)
  58.  
  59.                             s = s & ".localize"
  60.  
  61.                         End If
  62.  
  63.                         tmp_out = tmp_out & s
  64.  
  65.                         orig_counter = orig_counter + 1
  66.  
  67.                         REM Console.WriteLine("TMP:" & tmp_out)
  68.  
  69.                     Next
  70.  
  71.                 Else
  72.                     tmp_out = fileReader
  73.                 End If
  74.  
  75.                
  76.                 REM Console.WriteLine("Line:" & tmp_out)
  77.                 out = out & tmp_out & vbNewLine
  78.  
  79.             End If
  80.  
  81.         Loop Until fileReader Is Nothing
  82.         reader.Close()
  83.  
  84.         My.Computer.FileSystem.WriteAllText("c:\Users\user\Downloads\Game.Dev.Tycoon.v1.6.15\Game.Dev.Tycoon.v1.6.15\compressed\codeNw.js", out, False)
  85.  
  86.         Console.WriteLine("hotovo")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement