public EDDN.ShipyardObject GetShipFromFDevIDs(SQL.Datasets.dsEliteDB.tbshipyardbaseDataTable basedata, Newtonsoft.Json.Linq.JToken shipyardItem, bool param1) { EDDN.ShipyardObject shipyardObject = null; String skuString = null; try { if(shipyardItem != null) { if (shipyardItem.SelectToken("id", false) == null) throw new NotSupportedException(String.Format("Missing id : {0}", shipyardItem)); SQL.Datasets.dsEliteDB.tbshipyardbaseRow itemData = basedata.FindByid((Int32)shipyardItem.SelectToken("id", false)); if(itemData != null) { shipyardObject = new EDDN.ShipyardObject(); shipyardObject.Id = itemData.id; shipyardObject.Name = itemData.name; shipyardObject.BaseValue = shipyardItem.SelectToken("basevalue").ToString(); shipyardObject.Sku = skuString = (shipyardItem.SelectToken("sku", false) ?? "").ToString(); if(shipyardItem.SelectToken("unavailableReason", false) != null) shipyardObject.UnavailableReason = shipyardItem.SelectToken("unavailableReason", false).ToString(); if(shipyardItem.SelectToken("factionId", false) != null) shipyardObject.FactionID = shipyardItem.SelectToken("factionId", false).ToString(); if(shipyardItem.SelectToken("requiredRank", false) != null) shipyardObject.RequiredRank = shipyardItem.SelectToken("requiredRank", false).ToString(); } else throw new NotSupportedException(String.Format("{0}: Unknown ship", shipyardItem)); } else Debug.Print("!"); return shipyardObject; } catch (NotSupportedException ex) { Program.MainLog.Log(String.Format("Converting error: {0}", ex.Message)); } catch (Exception ex) { throw new Exception("Error while converting companion data to shipyard object", ex); } return null; }
public EDDN.ShipyardObject GetShipFromFDevIDs(SQL.Datasets.dsEliteDB.tbshipyardbaseDataTable basedata, Newtonsoft.Json.Linq.JToken shipyardItem, bool param1) { EDDN.ShipyardObject shipyardObject = null; String skuString = null; try { if (shipyardItem != null) { if (shipyardItem.SelectToken("id", false) == null) { throw new NotSupportedException(String.Format("Missing id : {0}", shipyardItem)); } SQL.Datasets.dsEliteDB.tbshipyardbaseRow itemData = basedata.FindByid((Int32)shipyardItem.SelectToken("id", false)); if (itemData != null) { shipyardObject = new EDDN.ShipyardObject(); shipyardObject.Id = itemData.id; shipyardObject.Name = itemData.name; shipyardObject.BaseValue = shipyardItem.SelectToken("basevalue").ToString(); shipyardObject.Sku = skuString = (shipyardItem.SelectToken("sku", false) ?? "").ToString(); if (shipyardItem.SelectToken("unavailableReason", false) != null) { shipyardObject.UnavailableReason = shipyardItem.SelectToken("unavailableReason", false).ToString(); } if (shipyardItem.SelectToken("factionId", false) != null) { shipyardObject.FactionID = shipyardItem.SelectToken("factionId", false).ToString(); } if (shipyardItem.SelectToken("requiredRank", false) != null) { shipyardObject.RequiredRank = shipyardItem.SelectToken("requiredRank", false).ToString(); } } else { throw new NotSupportedException(String.Format("{0}: Unknown ship", shipyardItem)); } } else { Debug.Print("!"); } return(shipyardObject); } catch (NotSupportedException ex) { Program.MainLog.Log(String.Format("Converting error: {0}", ex.Message)); } catch (Exception ex) { throw new Exception("Error while converting companion data to shipyard object", ex); } return(null); }