void AppendConfig(ref StringBuilder sb, config conf, tablerowdiff filter = null) { sb.Append("\t"); sb.Append(conf.GenString(filter)); sb.Append(","); sb.Append("\n"); }
public tablerowdiff GetCellAllStatus(string rowid, int branchIdx) { if (!currentLuaTableData.tableDiffs[branchIdx].modifiedrows.ContainsKey(rowid)) { return(null); } tablerowdiff tablerowdiff = currentLuaTableData.tableDiffs[branchIdx].modifiedrows[rowid]; return(tablerowdiff); }
public string GenString(tablerowdiff filter = null) { StringBuilder sb = new StringBuilder(string.Format(configformat, key)); int cells = 0; for (int i = 0; i < properties.Count; i++) { if (filter != null && filter.deletedcells.ContainsKey(properties[i].name)) { continue; } if (filter != null && filter.modifiedcells.ContainsKey(properties[i].name)) { AppendProperty(ref sb, properties[i], filter.modifiedcells[properties[i].name].value); } else { AppendProperty(ref sb, properties[i]); } cells++; } if (filter != null && filter.addedcells.Count > 0) { foreach (var p in filter.addedcells.Values) { AppendProperty(ref sb, p); } cells++; } if (cells > 0)//删除最后一行的逗号和空格 ", " { sb.Remove(sb.Length - 2, 2); } sb.Append("}"); return(sb.ToString()); }
private void IDListView_SelectChange(object sender, SelectionChangedEventArgs e) { IDListItem item = (sender as ListView).SelectedItem as IDListItem; if (item == null) { propertyDataGrid.ItemsSource = null; return; } _IDItemSelected = item; ObservableCollection <PropertyListItem> fieldList = new ObservableCollection <PropertyListItem>(); Excel excel = GlobalCfg.Instance.GetParsedExcel(_excelItemChoosed.FilePath); if (excel == null) { (sender as ListView).SelectedItem = null; return; } List <PropertyInfo> propertyList = excel.Properties; List <lparser.config> configs = GlobalCfg.Instance.GetTableRows(item.ID); lparser.config fullConfig = configs[0]; foreach (lparser.config config in configs) { if (config != null) { if (config.properties.Count > fullConfig.properties.Count) { fullConfig = config; } } } string ename = string.Empty; string cname = string.Empty; for (int i = 0, j = 0; i < fullConfig.properties.Count; i++) { ename = fullConfig.properties[i].name; while (propertyList[j].ename != ename) { j++; } cname = propertyList[j].cname; fieldList.Add(new PropertyListItem() { IsNeedGen = GlobalCfg.Instance.GetIsNeedGen(fullConfig.key, ename), PropertyName = cname + "(" + ename + ")", EnName = ename, LocalContent = configs[0] != null && configs[0].propertiesDic.ContainsKey(ename) ? configs[0].propertiesDic[ename].value4Show : null, Trunk = configs[1] != null && configs[1].propertiesDic.ContainsKey(ename) ? configs[1].propertiesDic[ename].value4Show : null, Studio = configs[2] != null && configs[2].propertiesDic.ContainsKey(ename) ? configs[2].propertiesDic[ename].value4Show : null, TF = configs[3] != null && configs[3].propertiesDic.ContainsKey(ename) ? configs[3].propertiesDic[ename].value4Show : null, Release = configs[4] != null && configs[4].propertiesDic.ContainsKey(ename) ? configs[4].propertiesDic[ename].value4Show : null }); } propertyDataGrid.ItemsSource = fieldList; RefreshGenBtnState(); //刷新单元格颜色 for (int j = 0; j < GlobalCfg.BranchCount; j++) { tablerowdiff trd = GlobalCfg.Instance.GetCellAllStatus(item.ID, j); if (trd == null) { continue; } for (int a = 0; a < fieldList.Count; a++) { if (trd.modifiedcells != null && trd.modifiedcells.ContainsKey(fieldList[a].EnName)) { DataGridCell dataGridCell = WPFHelper.GetCell(propertyDataGrid, a, j + 3); dataGridCell.Background = Brushes.LightBlue; } if (trd.modifiedcells != null && trd.addedcells.ContainsKey(fieldList[a].EnName)) { DataGridCell dataGridCell = WPFHelper.GetCell(propertyDataGrid, a, j + 3); dataGridCell.Background = Brushes.LightPink; } if (trd.modifiedcells != null && trd.deletedcells.ContainsKey(fieldList[a].EnName)) { DataGridCell dataGridCell = WPFHelper.GetCell(propertyDataGrid, a, j + 3); dataGridCell.Background = Brushes.LightBlue; } } } }
private void IDListView_SelectChange(object sender, SelectionChangedEventArgs e) { IDListItem item = (sender as ListView).SelectedItem as IDListItem; if (item == null) { return; } Excel excel = GlobalCfg.Instance.GetParsedExcel(_listItemChoosed.FilePath); List <PropertyInfo> propertyList = excel.Properties; ObservableCollection <PropertyListItem> fieldList = new ObservableCollection <PropertyListItem>(); _IDItemSelected = item; List <lparser.config> configs = GlobalCfg.Instance.GetTableRow(item.ID); string ename = string.Empty; for (int i = 0; i < propertyList.Count; i++) { ename = propertyList[i].ename; fieldList.Add(new PropertyListItem() { PropertyName = propertyList[i].cname, EnName = propertyList[i].ename, Context = configs[0] != null && configs[0].propertiesDic.ContainsKey(ename) ? configs[0].propertiesDic[ename].value : null, Trunk = configs[1] != null && configs[1].propertiesDic.ContainsKey(ename) ? configs[1].propertiesDic[ename].value : null, Studio = configs[2] != null && configs[2].propertiesDic.ContainsKey(ename) ? configs[2].propertiesDic[ename].value : null, TF = configs[3] != null && configs[3].propertiesDic.ContainsKey(ename) ? configs[3].propertiesDic[ename].value : null, Release = configs[4] != null && configs[4].propertiesDic.ContainsKey(ename) ? configs[4].propertiesDic[ename].value : null }); } propertyDataGrid.ItemsSource = fieldList; ResetGenBtnState(); //刷新单元格颜色 for (int j = 0; j < GlobalCfg.BranchCount; j++) { tablerowdiff trd = GlobalCfg.Instance.GetCellAllStatus(item.ID, j); if (trd == null) { continue; } for (int a = 0; a < fieldList.Count; a++) { if (trd.modifiedcells != null && trd.modifiedcells.ContainsKey(fieldList[a].EnName)) { DataGridCell dataGridCell = GetCell(propertyDataGrid, a, j + 3); dataGridCell.Background = Brushes.LightBlue; } if (trd.modifiedcells != null && trd.addedcells.ContainsKey(fieldList[a].EnName)) { DataGridCell dataGridCell = GetCell(propertyDataGrid, a, j + 3); dataGridCell.Background = Brushes.LightPink; } if (trd.modifiedcells != null && trd.deletedcells.ContainsKey(fieldList[a].EnName)) { DataGridCell dataGridCell = GetCell(propertyDataGrid, a, j + 3); dataGridCell.Background = Brushes.LightBlue; } } } }