- 151
- 38
C#:
using System;
using System.IO;
class Test
{
public static void Main()
{
int[] x = new int[50];
int i = 0;
try
{
using (StreamReader sr = new StreamReader("chisla.txt"))
using (StreamWriter sw = new StreamWriter("Pesnya.lua"))
{
string line;
sw.WriteLine("function main()");
sw.WriteLine("if not isSampfuncsLoaded() or not isSampLoaded() then return end");
sw.WriteLine("while not isSampAvailable() do wait(100) end");
sw.WriteLine("while true do wait(0)");
sw.WriteLine("if testCheat('RES') then");
sw.WriteLine("thisScript():reload()");
sw.WriteLine("end");
sw.WriteLine("if testCheat('SONG') then");
//sw.WriteLine("wait(1000)");
while ((line = sr.ReadLine()) != null)
{
int.TryParse(line, out x[i]);
Console.WriteLine($"{line}, {i + 1}-й элемент равен {x[i]}");
DirectoryInfo[] cDirs = new DirectoryInfo(@"c:\").GetDirectories();
sw.WriteLine($"sampSendChat('{line}')");
sw.WriteLine("wait(1000)");
x[i]++;
i++;
}
sw.WriteLine("end");
sw.WriteLine("end");
sw.WriteLine("end");
}
}
catch (Exception e)
{
Console.WriteLine("The file could not be read:");
Console.WriteLine(e.Message);
}
}
}