Legacy board name is now case-insensitive

main
Inga 🏳‍🌈 15 years ago
parent 01e41b2262
commit 4520faa013
  1. 7
      Common/dataobjects/Board.cs

@ -139,7 +139,7 @@ namespace FLocal.Common.dataobjects {
this._name = data[TableSpec.FIELD_NAME]; this._name = data[TableSpec.FIELD_NAME];
this._description = data[TableSpec.FIELD_DESCRIPTION]; this._description = data[TableSpec.FIELD_DESCRIPTION];
this._parentBoardId = Util.ParseInt(data[TableSpec.FIELD_PARENTBOARDID]); this._parentBoardId = Util.ParseInt(data[TableSpec.FIELD_PARENTBOARDID]);
this._legacyName = data[TableSpec.FIELD_LEGACYNAME]; this._legacyName = data[TableSpec.FIELD_LEGACYNAME].ToLower();
} }
private readonly object subBoards_Locker = new object(); private readonly object subBoards_Locker = new object();
@ -229,8 +229,9 @@ namespace FLocal.Common.dataobjects {
private static readonly IEnumerable<int> allBoardsIds = from stringId in Config.instance.mainConnection.LoadIdsByConditions(TableSpec.instance, new EmptyCondition(), Diapasone.unlimited) select int.Parse(stringId); private static readonly IEnumerable<int> allBoardsIds = from stringId in Config.instance.mainConnection.LoadIdsByConditions(TableSpec.instance, new EmptyCondition(), Diapasone.unlimited) select int.Parse(stringId);
private static Dictionary<string, int> legacyName2Id = new Dictionary<string,int>(); private static Dictionary<string, int> legacyName2Id = new Dictionary<string,int>();
public static Board LoadByLegacyName(string legacy) { public static Board LoadByLegacyName(string _legacy) {
if((legacy == null) || (legacy == "")) throw new FLocalException("legacy name is empty"); if((_legacy == null) || (_legacy == "")) throw new FLocalException("legacy name is empty");
string legacy = _legacy.ToLower();
if(!legacyName2Id.ContainsKey(legacy)) { if(!legacyName2Id.ContainsKey(legacy)) {
lock(legacyName2Id) { lock(legacyName2Id) {
if(!legacyName2Id.ContainsKey(legacy)) { if(!legacyName2Id.ContainsKey(legacy)) {

Loading…
Cancel
Save