Esempio n. 1
0
        private void ClearColumn(int columnIndex)
        {
            IList <string> resKeys = new List <string>(languageResources.Keys);

            //foreach(string key in  resKeys) {
            foreach (LanguageEntry e in languageResources.Values)
            {
                if (columnIndex == 1)
                {
                    e.Entry1 = null;
                }
                else if (columnIndex == 2)
                {
                    e.Entry2 = null;
                }
                else
                {
                    throw new ArgumentOutOfRangeException("Argument columnIndex must be either 1 or 2");
                }
            }
            // remove entries with two null values
            foreach (string key in  resKeys)
            {
                LanguageEntry e = languageResources[key];
                if (string.IsNullOrWhiteSpace(e.Entry1) && string.IsNullOrWhiteSpace(e.Entry2))
                {
                    languageResources.Remove(e.Key);
                }
            }
        }
Esempio n. 2
0
        private void PopulateColumn(LanguageFile languageFile, int columnIndex)
        {
            ClearColumn(columnIndex);
            IDictionary <string, string> resources = GreenshotLanguage.ReadLanguageFile(languageFile);

            foreach (string key in resources.Keys)
            {
                LanguageEntry entry = GetOrCreateLanguageEntry(key);
                if (columnIndex == 1)
                {
                    entry.Entry1 = resources[key];
                }
                else if (columnIndex == 2)
                {
                    entry.Entry2 = resources[key];
                }
                else
                {
                    throw new ArgumentOutOfRangeException("Argument columnIndex must be either 1 or 2");
                }
            }
            if (columnIndex == 1)
            {
                unsavedChangesInLanguage1 = false;
            }
            if (columnIndex == 2)
            {
                unsavedChangesInLanguage2 = false;
            }
        }
Esempio n. 3
0
        private LanguageEntry GetOrCreateLanguageEntry(string key)
        {
            LanguageEntry entry;

            if (languageResources.ContainsKey(key))
            {
                entry = languageResources[key];
            }
            else
            {
                entry     = new LanguageEntry();
                entry.Key = key;
                languageResources.Add(key, entry);
            }
            return(entry);
        }
Esempio n. 4
0
 private int compareEntryKeys(LanguageEntry a, LanguageEntry b)
 {
     return(a.Key.CompareTo(b.Key));
 }