Exemplo n.º 1
0
        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;
        }
Exemplo n.º 2
0
            public void addMappingToCurrentListAndSaveIt(string pathToFind, string pathToReplace)
            {
                var mappings = new List<SourceCodeMappingsMapping>(SourceCodeMappingsUtils.sourceCodeMappings.Mapping);

                var sourceCodeMappings = new SourceCodeMappingsMapping();
                sourceCodeMappings.withThisString = pathToReplace;
                sourceCodeMappings.replaceThisString = pathToFind;

                mappings.Add(sourceCodeMappings);
                SourceCodeMappingsUtils.sourceCodeMappings.Mapping = mappings.ToArray();
                saveSourceCodeMappings(SourceCodeMappingsUtils.sourceCodeMappings);
            }