public static SourceCodeMappings getSourceCodeMappings() { try { if (File.Exists(getSourceCodeMappingsFile())) return (SourceCodeMappings)Serialize.getDeSerializedObjectFromXmlFile(getSourceCodeMappingsFile(), typeof(SourceCodeMappings)); } catch (Exception ex) { "[getSourceCodeMappings] {0}".error(ex.Message); } var scmSourceCodeMappings = new SourceCodeMappings(); scmSourceCodeMappings.Mapping = new SourceCodeMappingsMapping[] {}; return scmSourceCodeMappings; }
public static SourceCodeMappings getSourceCodeMappingsFromDataGridView(DataGridView dgvDataGridView) { if (dgvDataGridView.Columns.Count != 2) { PublicDI.log.error( "in getSourceCodeMappingsFromDataGridView: invalid DataGridView : dgvDataGridView.Columns.Count != 2 "); return null; } var lmMappings = new List<SourceCodeMappingsMapping>(); foreach (DataGridViewRow rRow in dgvDataGridView.Rows) { if (rRow.Cells[0].Value != null && rRow.Cells[1].Value != null) { var mMapping = new SourceCodeMappingsMapping(); mMapping.withThisString = rRow.Cells[1].Value.ToString(); mMapping.replaceThisString = rRow.Cells[0].Value.ToString(); lmMappings.Add(mMapping); } } var scmSourceCodeMappings = new SourceCodeMappings(); scmSourceCodeMappings.Mapping = lmMappings.ToArray(); return scmSourceCodeMappings; }
static SourceCodeMappingsUtils() { sourceCodeMappingFileName = "SourceCodeMappingsFile.xml"; // must be set before the call to getSourceCodeMappings(); sourceCodeMappings = SourceCodeMappingsUtils.getSourceCodeMappings(); }
public static void saveSourceCodeMappings(SourceCodeMappings scmSourceCodeMappings) { Serialize.createSerializedXmlFileFromObject(scmSourceCodeMappings, getSourceCodeMappingsFile(), null); }