public string GetMapBackgroundTable() { StringBuilder s = new StringBuilder(); var table = "| {0,-3} | {1,-10} | {2,-20} |"; s.AppendLine(String.Format(table, "On", "Background", "Description")); var tableDashLine = String.Format(table, GetDashLine(3), GetDashLine(10), GetDashLine(20)); s.AppendLine(tableDashLine); var vanilla = false; foreach (var row in VanillaDatabase.getMapTable().Rows) { var dataRow = (DataRow)row; var bg = dataRow.Field <string>("Background"); var desc = dataRow.Field <string>("Description"); var on = " "; if (md.Background == bg) { vanilla = true; on = ":o:"; } s.AppendLine(String.Format(table, on, bg, desc)); } if (!vanilla) { s.AppendLine(String.Format(table, ":o:", md.Background, "")); } RemoveTrailingLineEnding(s); return(s.ToString()); }
public static Optional <string> getVanillaTpl(string mapIcon) { try { var result = from row in VanillaDatabase.getMapTable().AsEnumerable() where row.Field <string>("Map Icon") == mapIcon select row.Field <string>("Map Tpl"); if (result.Any() && result.Distinct().Single() != null) { return(Optional <string> .Create(result.Distinct().Single())); } } catch (IndexOutOfRangeException e) { } return(Optional <string> .CreateEmpty()); }
public static Optional <UInt32> getBgmIdFromVanillaBackground(string background) { try { var result = from row in VanillaDatabase.getMapTable().AsEnumerable() where row.Field <string>("Background") == background select row.Field <UInt32>("Bgm Id"); if (result.Any()) { return(Optional <UInt32> .Create(result.Distinct().Single())); } } catch (IndexOutOfRangeException e) { } return(Optional <UInt32> .CreateEmpty()); }