Example #1
0
        void Form1_DragDrop(object sender, DragEventArgs e)
        {
            string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
            foreach (string file in files)
            {
                if (StringsExe.CheckIfStringsExt(file) && !CheckAlreadyExistsInTable(file))
                {
                    dataTable.LoadDataRow((String[])new ArrayList()
                    {
                        file, file, Path.GetExtension(file)
                    }.ToArray(typeof(string)), true);
                }
            }

            ChangeDestPaths();
        }
Example #2
0
        public Form1()
        {
            InitializeComponent();

            textBox1.Text  = "D:/";
            comboBox1.Text = comboBox1.Items[0].ToString();

            this.AllowDrop  = true;
            this.DragEnter += new DragEventHandler(Form1_DragEnter);
            this.DragDrop  += new DragEventHandler(Form1_DragDrop);

            dataTable = new DataTable();
            dataGridView1.DataSource = dataTable;
            dataTable.Columns.Add("Имя оригинального .STRINGS");
            dataTable.Columns.Add("Имя будущего .STRINGS");
            dataTable.Columns.Add("Тип");
            dataGridView1.AutoSizeColumnsMode   = DataGridViewAutoSizeColumnsMode.Fill;
            dataGridView1.Columns[0].FillWeight = 100;
            dataGridView1.Columns[1].FillWeight = 100;
            dataGridView1.Columns[2].FillWeight = 30;

            if (Program.Args.Length != 0)
            {
                foreach (string file in Program.Args)
                {
                    if (StringsExe.CheckIfStringsExt(file) && !CheckAlreadyExistsInTable(file))
                    {
                        dataTable.LoadDataRow((String[])new ArrayList()
                        {
                            file, file, Path.GetExtension(file)
                        }.ToArray(typeof(string)), true);
                    }
                }
            }

            ChangeDestPaths();
        }
Example #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            StringsExe.ExtractResource("StringsPacker.exe", Application.StartupPath + "\\temp\\");
            StringsExe.ExtractResource("StringsUnpacker.exe", Application.StartupPath + "\\temp\\");

            string stringsPackerPath   = "\\temp\\StringsPacker.exe";
            string stringsUnpackerPath = "\\temp\\StringsUnpacker.exe";
            string tempPath            = "\\temp\\";
            string line = "";
            string orig = "";
            string dest = "";

            for (int i = 0; i < dataGridView1.RowCount; i++)
            {
                orig = dataGridView1.Rows[i].Cells[0].Value.ToString();
                dest = dataGridView1.Rows[i].Cells[1].Value.ToString();

                ///////String to Csv
                line = "";

                if (dataGridView1.Rows[i].Cells[2].Value.Equals(".ILSTRINGS"))
                {
                    line += "/IL ";
                }
                else if (dataGridView1.Rows[i].Cells[2].Value.Equals(".DLSTRINGS"))
                {
                    line += "/DL ";
                }

                line += StringsExe.StringsToCsv(orig, Application.StartupPath + tempPath);

                StringsExe.StartProcess("\"" + Application.StartupPath + stringsUnpackerPath + "\"", line);

                ///////UTF-8ToAnsi
                if (comboBox1.Text.Equals(comboBox1.Items[0]))
                {
                    StringsExe.ConvertUTF8ToAnsi(Application.StartupPath + tempPath + "file.csv", Application.StartupPath + tempPath + "file1.csv");
                }
                else if (comboBox1.Text.Equals(comboBox1.Items[1]))
                {
                    StringsExe.ConvertAnsiToUTF8(Application.StartupPath + tempPath + "file.csv", Application.StartupPath + tempPath + "file1.csv");
                }

                ///////Csv to String
                line = "";

                if (dataGridView1.Rows[i].Cells[2].Equals(".ILSTRINGS"))
                {
                    line += "/IL ";
                }
                else if (dataGridView1.Rows[i].Cells[2].Equals(".DLSTRINGS"))
                {
                    line += "/DL ";
                }

                line += StringsExe.CsvToStrings(Application.StartupPath + tempPath + "file1.csv", dest);

                StringsExe.StartProcess("\"" + Application.StartupPath + stringsPackerPath + "\"", line);

                StringsExe.DeleteFile(Application.StartupPath + tempPath + "file.csv");
                StringsExe.DeleteFile(Application.StartupPath + tempPath + "file1.csv");
            }

            StringsExe.DeleteDirectory("\\temp\\", Application.StartupPath + "\\temp\\");
        }