コード例 #1
0
        private void kryptonButtonInput_Click(object sender, EventArgs e)
        {
            if (DialogResult.No == KryptonMessageBox.Show(
                                    "���������Ḳ��Ŀ¼���Ѵ��ڵ��ļ���Ҫ��ʼ��һ���ɱ¾��",
                                    "Ŷ���㿪�ң�",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2))
                return;

            int count = 0;
            try
            {
                foreach (var file in Directory.GetFiles(kryptonTextBox2.Text, "*.sav"))
                {
                    count++;

                    var textData = new TextData();

                    var stfp = new SavedTranslationFormatProvider(file);

                    textData.LoadTranslation(Path.Combine(kryptonTextBox1.Text, Path.GetFileName(stfp.ScriptPath)),
                                             stfp.Lines);

                    textData.BuildScript(Path.Combine(kryptonTextBox3.Text, Path.GetFileName(stfp.ScriptPath)));
                }
            }
            catch (Exception ea)
            {
                KryptonMessageBox.Show(ea.Message);
            }

            KryptonMessageBox.Show(string.Format("�ѵ��� {0} ���ļ���", count));
        }
コード例 #2
0
        private void kryptonButtonOutput_Click(object sender, EventArgs e)
        {
            if (DialogResult.No == KryptonMessageBox.Show(
                                    "���������Ḳ��Ŀ¼���Ѵ��ڵ��ļ���Ҫ��ʼ��һ���ɱ¾��",
                                    "Ŷ���㿪�ң�",
                                    MessageBoxButtons.YesNo,
                                    MessageBoxIcon.Question,
                                    MessageBoxDefaultButton.Button2))
                return;

            int count = 0;
            try
            {
                var textData = new TextData();
                foreach (var file in Directory.GetFiles(kryptonTextBox1.Text,
                                                        "*." + textData.Library.GetSupportExtension()))
                {
                    count++;

                    textData.OpenScript(file);

                    SavedTranslationFormatProvider.MakeSavedTranslation(
                        Path.Combine(kryptonTextBox2.Text, Path.GetFileName(file) + ".sav"),
                        file,
                        textData.Library.GetLibraryInfo(),
                        TimeSpan.Zero,
                        textData.Library.GetDefaultEncoding(),
                        0,
                        textData.GetLineInfoAll()
                        );
                }
            }
            catch (Exception ea)
            {
                KryptonMessageBox.Show(ea.Message);
            }

            KryptonMessageBox.Show(string.Format("�ѵ��� {0} ���ļ���", count));
        }