View difference between Paste ID: mAEuNXYd and fBvu9UPY
SHOW: | | - or go back to the newest paste.
1-
public class TextDrawReader
1+
TextDrawReader tdReader = new TextDrawReader();
2
ProgressBarReader pbReader = new ProgressBarReader();
3-
    private readonly string[,] _textdraw =
3+
TextDraw[] tdArray = tdReader.TextDraw(txtArquivoTD.Text);
4-
        {
4+
ProgressBar[] pbArray = pbReader.ProgressBar(txtArquivoTD.Text);
5-
            {"TextDrawFont", "PlayerTextDrawFont"},
5+
6-
            {"TextDrawSetOutline", "PlayerTextDrawSetOutline"},
6+
string line = "";
7-
            { "TextDrawSetShadow", "PlayerTextDrawSetShadow"},
7+
int countIdx = 0;
8-
            { "TextDrawLetterSize", "PlayerTextDrawLetterSize"},
8+
int countPlayer = 0, countGlobal = 0;
9-
            { "TextDrawColor", "PlayerTextDrawColor"},
9+
int countProgressBar = 0;
10-
            { "TextDrawBackgroundColor", "PlayerTextDrawBackgroundColor"},
10+
foreach (TextDraw td in tdArray)
11-
            { "TextDrawBoxColor", "PlayerTextDrawBoxColor"},
11+
12-
            { "TextDrawUseBox", "PlayerTextDrawUseBox"},
12+
	line += $"td_{countIdx}_string={td.Text.Replace(' ', '_')}\r\n";
13-
            { "TextDrawTextSize", "PlayerTextDrawTextSize"},
13+
	line += $"td_{countIdx}_data=";
14-
            { "TextDrawSetSelectable", "PlayerTextDrawSetSelectable"},
14+
	line += td.Position.X.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
15-
            { "TextDrawAlignment", "PlayerTextDrawAlignment"},
15+
	line += td.Position.Y.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
16-
            { "TextDrawSetProportional", "PlayerTextDrawSetProportional"},
16+
	line += td.Font + " ";
17-
            { "TextDrawSetPreviewModel", "PlayerTextDrawSetPreviewModel"},
17+
	line += (td.IsPublic ? 1 : 0) + " ";
18-
            { "TextDrawSetPreviewVehCol", "PlayerTextDrawSetPreviewVehCol"},
18+
	line += td.Outline + " ";
19-
            { "TextDrawSetPreviewRot", "PlayerTextDrawSetPreviewRot"}
19+
	line += td.Shadow + " ";
20-
        };
20+
	line += td.LetterSize.X.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
21
	line += td.LetterSize.Y.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
22-
    public TextDraw[] TextDraw(string file)
22+
	line += td.Color + " ";
23-
    {
23+
	line += td.BackgroundColor + " ";
24-
        List<TextDraw> tdArray = new List<TextDraw>();
24+
	line += td.BoxColor + " ";
25
	line += (td.UseBox ? 1 : 0) + " ";
26-
        string[] flines = File.ReadAllLines(file);
26+
	line += td.TextSize.X.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
27-
        int textdrawType = -1;
27+
	line += td.TextSize.Y.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
28-
        TextDraw td = new TextDraw
28+
	line += (td.Selectable ? 1 : 0) + " ";
29-
        {
29+
	line += td.Alignment + " ";
30-
            LetterSize = new TextDraw.LetterSizeData(),
30+
	line += td.Proportional + " ";
31-
            TextSize = new TextDraw.TextSizeData(),
31+
	line += td.Preview.Model + " ";
32-
            Position = new TextDraw.PositionData(),
32+
	line += td.Preview.Color1 + " ";
33-
            Preview = new TextDraw.PreviewModelData()
33+
	line += td.Preview.Color2 + " ";
34-
        };
34+
	line += td.Preview.X.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
35
	line += td.Preview.Y.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
36-
        for (int i = 0; i < flines.Length; i++)
36+
	line += td.Preview.Z.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
37-
        {
37+
	line += td.Preview.Zoom.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
38-
            string cline = flines[i].Trim();
38+
	line += "255 "; // Color Alpha
39-
            if (string.IsNullOrEmpty(cline) || i == (flines.Length - 1))
39+
	line += "255 "; // Background Color Alpha
40-
            {
40+
	line += "50 "; // Box Color Alpha
41-
                if (textdrawType > -1)
41+
	line += td.VariableName + "\r\n";
42-
                {
42+
	line += $"td_{countIdx}_bar_data=100.000000 0 \r\n";
43-
                    tdArray.Add(td);
43+
	File.AppendAllText(filename, line);
44-
                    td = new TextDraw
44+
	
45-
                    {
45+
	line = "";
46-
                        LetterSize = new TextDraw.LetterSizeData(),
46+
	countIdx++;
47-
                        TextSize = new TextDraw.TextSizeData(),
47+
	countPlayer += td.IsPublic ? 0 : 1;
48-
                        Position = new TextDraw.PositionData(),
48+
	countGlobal += td.IsPublic ? 1 : 0;
49-
                        Preview = new TextDraw.PreviewModelData()
49+
50-
                    };
50+
51-
                }
51+
foreach (ProgressBar pb in pbArray)
52
{
53-
                textdrawType = -1;
53+
	line += $"td_{countIdx}_string=PlayerProgressBar\r\n";
54-
                continue;
54+
	line += $"td_{countIdx}_data=";
55-
            }
55+
	line += pb.X.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
56
	line += pb.Y.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
57-
            if (cline.Contains("TextDrawCreate"))
57+
	line += "6 1 1 0 0.600000 2.000000 ";
58-
            {
58+
	line += pb.Colour + " ";
59-
                if (textdrawType > -1)
59+
	line += "255 50 1 ";
60-
                {
60+
	line += pb.Width.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
61-
                    tdArray.Add(td);
61+
	line += pb.Height.ToString(CultureInfo.CurrentCulture).Replace(',', '.') + " ";
62-
                    td = new TextDraw
62+
	line += "0 1 1 0 1 1 -10.000000 0.000000 -20.000000 1.000000 ";
63-
                    {
63+
	line += "255 "; // Color Alpha
64-
                        LetterSize = new TextDraw.LetterSizeData(),
64+
	line += "255 "; // Background Color Alpha
65-
                        TextSize = new TextDraw.TextSizeData(),
65+
	line += "50 "; // Box Color Alpha
66-
                        Position = new TextDraw.PositionData(),
66+
	line += pb.VariableName + "\r\n";
67-
                        Preview = new TextDraw.PreviewModelData()
67+
	line += $"td_{countIdx}_bar_data=100.000000 {pb.Direction} \r\n";
68-
                    };
68+
	File.AppendAllText(filename, line);
69-
                }
69+
	
70
	line = "";
71-
                int idx1 = cline.IndexOf('(');
71+
	countIdx++;
72-
                int idx2 = cline.IndexOf(',', idx1 + 1);
72+
	countProgressBar++;
73-
                string valor = cline.Substring(idx1 + 1, idx2 - idx1 - 1).Trim();
73+