예제 #1
0
        private void btnMergeTranslate_Click(object sender, EventArgs e)
        {
            string translatedpath = OutPathBinTranslate + (tIs64 ? @"Translation64.xml" : @"Translation.xml");//exported xml

            if (!File.Exists(translatedpath))
            {
                MessageBox.Show("Original translation.xml file not found make sure you have unpacked local file and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else if (!File.Exists(FileTranslate))
            {
                MessageBox.Show("Merge translation.xml file not found make sure you have selected it and try again.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Console.WriteLine("\rMerging translation...");
                RunWithWorker(((o, args) =>
                {
                    TranslateReader translateControl_Na = new TranslateReader();
                    translateControl_Na.Load(FileTranslate);//translated xml

                    TranslateReader translateControl_Org = new TranslateReader();
                    translateControl_Org.Load(translatedpath, true);//

                    translateControl_Org.MergeTranslation(translateControl_Na, translatedpath);
                }));
            }
        }
예제 #2
0
    public static Dictionary <string, string> GetAndLoadTranslations(Dictionary <Object, string> mapDictionary, string culture)
    {
        try
        {
            TranslateReader reader = new TranslateReader(culture);

            foreach (var item in mapDictionary)
            {
                string value = "";

                if (reader.Dictionary.TryGetValue(item.Value, out value))
                {
                    if (item.Key.GetType().GetProperty("Text") != null)
                    {
                        item.Key.GetType().GetProperty("Text").SetValue(item.Key, value, null);
                    }
                    else if (item.Key.GetType().GetProperty("HeaderText") != null)
                    {
                        item.Key.GetType().GetProperty("HeaderText").SetValue(item.Key, value, null);
                    }
                }
            }

            return(reader.Dictionary);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.Message);
        }

        return(new Dictionary <string, string>());
    }
예제 #3
0
        private void BtnMerge_Click(object sender, EventArgs e)
        {
            if (multiworker != null && multiworker.IsBusy)
            {
                multiworker.CancelAsync();
            }

            try
            {
                if (File.Exists(TranslationSourceFile) || File.Exists(TranslationTargetFile))
                {
                    Console.WriteLine("\rMerging translation...");
                    GboxTranslator.Enabled = false;
                    RunWithWorker(((o, args) =>
                    {
                        TranslateReader translateControl_Na = new TranslateReader();
                        translateControl_Na.Load(TranslationSourceFile);                                   //Source xml
                        TranslateReader translateControl_Org = new TranslateReader();
                        translateControl_Org.Load(TranslationTargetFile, true);                            //Target xml
                        translateControl_Org.MergeTranslation(translateControl_Na, TranslationTargetFile); //Target xml
                        GboxTranslator.Enabled = true;
                    }));
                }
                else
                {
                    MessageBox.Show("Translation files not exist please select source and merge files first.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
예제 #4
0
파일: DatTool.cs 프로젝트: zeffy/BnsDatTool
        void TranslateMerge(object sender, EventArgs e)
        {
            Console.WriteLine("\rMerging translation...");

            TranslateReader translateControl_Na = new TranslateReader();

            translateControl_Na.Load(SourceMergeFile);//Source xml

            TranslateReader translateControl_Org = new TranslateReader();

            translateControl_Org.Load(TargetMergeFile, true);                            //Target xml

            translateControl_Org.MergeTranslation(translateControl_Na, TargetMergeFile); //Target xml
        }