/
Result.cs
47 lines (39 loc) · 1.28 KB
/
Result.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Translator
{
public partial class Result : Form
{
public Result()
{
InitializeComponent();
}
private void Result_Load(object sender, EventArgs e)
{
}
public void GenerateCode(DataGridView data)
{
StringBuilder sBuilder = new StringBuilder();
sBuilder.AppendLine("<?php");
sBuilder.AppendLine("");
sBuilder.AppendLine("global $_LANG;");
sBuilder.AppendLine("$_LANG = array();");
sBuilder.AppendLine("");
foreach (DataGridViewRow row in data.Rows)
{
string filename = row.Cells["Filename"].Value.ToString();
string md5Hash = row.Cells["MD5Hash"].Value.ToString();
string input = row.Cells["Input"].Value.ToString();
string output = row.Cells["Output"].Value.ToString();
sBuilder.AppendLine(string.Format("$_LANG['{0}_{1}'] = '{2}';", filename, md5Hash, output));
}
txtResult.Text = sBuilder.ToString();
}
}
}