Esempio n. 1
0
        public static StringDictionary SelectLowerletter(this StringDictionary dict)
        {
            var result = new StringDictionary();

            for (int i = 0; i < dict.Count(); i++)
            {
                if (dict.Keys.ElementAt(i).StartsWith(dict.Keys.ElementAt(i).ToLower()))
                {
                    result.Add(dict.Keys.ElementAt(i), dict.Values.ElementAt(i));
                }
            }
            return(result);
        }
Esempio n. 2
0
        private void bLoadXML_Click(object sender, EventArgs e)
        {
            openFileDialog1.DefaultExt = "xml";
            openFileDialog1.Filter     = "Language xml files|*.xml";
            if (openFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string filename = openFileDialog1.FileName;

            string translation = File.ReadAllText(filename);

            XmlSerializer xs = new XmlSerializer(m_strings.GetType());

            if (sender is Button && (sender as Button).Name == "bMergeInTranslation")
            {
                StringDictionary m_translatedstrings = (StringDictionary)xs.Deserialize(new StringReader(translation));
                foreach (var x in m_translatedstrings)
                {
                    if (m_strings.ContainsKey(x.Key))
                    {
                        m_strings[x.Key] = x.Value;
                    }
                    else
                    {
                        if (MessageBox.Show(x.Key + " is only defined in merged translation. Keep?", "Keep text?", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            m_strings[x.Key] = x.Value;
                        }
                    }
                }
            }
            else
            {
                m_strings         = (StringDictionary)xs.Deserialize(new StringReader(translation));
                label1.Text       = m_strings.Count().ToString() + " imported";
                tbPluginName.Text = KeePassLib.Utility.UrlUtil.GetFileName(filename);
                if (tbPluginName.Text.IndexOf(".") > -1)
                {
                    tbPluginName.Text = tbPluginName.Text.Substring(0, tbPluginName.Text.IndexOf("."));
                }
            }
            tbVersion.Text = PluginTranslate.TranslationVersion.ToString();
            InitStrings();
        }