예제 #1
0
            XElement MakeLocalizerSetElement(Project.TData.LocalizerSetData localizerSet)
            {
                var result = new XElement("LocalizationSet",
                                          new XAttribute("name", localizerSet.Name),
                                          new XAttribute("guid", localizerSet.Id.Serialized()));

                foreach (var mapping in localizerSet.Sources)
                {
                    result.Add(new XElement("Source", new XAttribute("type", mapping.Key.Serialized()), new XAttribute("file", mapping.Value.Serialized())));
                }
                return(result);
            }
예제 #2
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            Project.TData.LocalizerSetData[] result = new Project.TData.LocalizerSetData[dataGridView1.RowCount - 1]; //As far as I can tell the last row is, by requirement, empty
            for (int i = 0; i < result.Length; i++)
            {
                var row = dataGridView1.Rows[i];
                Dictionary <Id <LocalizedStringType>, Id <FileInProject> > sources = new Dictionary <Id <LocalizedStringType>, Id <FileInProject> >();
                foreach (var type in m_stringTypes.Select((value, index) => new { Value = value, Index = index }))
                {
                    sources[type.Value] = m_localizationFiles.FirstOrDefault(f => f.File.File.Name == (string)row.Cells[type.Index + 1].Value)?.Id ?? Id <FileInProject> .FromGuid(Guid.Empty);
                }
                var id = row.Tag as Id <Project.TData.LocalizerSetData> ?? Id <Project.TData.LocalizerSetData> .New();

                result[i] = new Project.TData.LocalizerSetData(id, row.Cells[0].Value.ToString(), sources);
            }
            if (CheckResultSane(result))
            {
                m_registerResult(result);
                Close();
            }
        }