Ejemplo n.º 1
0
        protected string MakeLink(string text, DwarfObject dObject, ControlOption option = ControlOption.Html)
        {
            string objectType;
            int    id;

            if (dObject is EventCollection eventCollection)
            {
                objectType = "collection";
                id         = eventCollection.Id;
            }
            else if (dObject is HistoricalFigure historicalFigure)
            {
                objectType = "hf";
                id         = historicalFigure.Id;
            }
            else if (dObject is Entity entity)
            {
                objectType = "entity";
                id         = entity.Id;
            }
            else if (dObject is WorldRegion worldRegion)
            {
                objectType = "region";
                id         = worldRegion.Id;
            }
            else if (dObject is UndergroundRegion undergroundRegion)
            {
                objectType = "uregion";
                id         = undergroundRegion.Id;
            }
            else if (dObject is Site site)
            {
                objectType = "site";
                id         = site.Id;
            }
            else
            {
                throw new Exception("Unhandled make link for type: " + dObject.GetType());
            }

            string optionString = "";

            if (option != ControlOption.Html)
            {
                optionString = "-" + option;
            }

            return("<a href=\"" + objectType + "#" + id + optionString + "\">" + text + "</a>");
        }
Ejemplo n.º 2
0
        protected string MakeLink(string text, DwarfObject dObject, ControlOption option = ControlOption.Html)
        {
            //<a href=\"collection#" + attack.ID + "\">" + attack.GetOrdinal(attack.Ordinal)
            string objectType = "";
            int    id         = 0;

            if (dObject is EventCollection)
            {
                objectType = "collection";
                id         = (dObject as EventCollection).Id;
            }
            else if (dObject.GetType() == typeof(HistoricalFigure))
            {
                objectType = "hf";
                id         = (dObject as HistoricalFigure).Id;
            }
            else if (dObject.GetType() == typeof(Entity))
            {
                objectType = "entity";
                id         = (dObject as Entity).Id;
            }
            else if (dObject.GetType() == typeof(WorldRegion))
            {
                objectType = "region";
                id         = (dObject as WorldRegion).Id;
            }
            else if (dObject.GetType() == typeof(UndergroundRegion))
            {
                objectType = "uregion";
                id         = (dObject as UndergroundRegion).Id;
            }
            else if (dObject.GetType() == typeof(Site))
            {
                objectType = "site";
                id         = (dObject as Site).Id;
            }
            else
            {
                throw new Exception("Unhandled make link for type: " + dObject.GetType());
            }

            string optionString = "";

            if (option != ControlOption.Html)
            {
                optionString = "-" + option;
            }

            return("<a href=\"" + objectType + "#" + id + optionString + "\">" + text + "</a>");
        }