public new static Economy FromEDName(string edname) { // Economy names from the journal are prefixed with "$economy_" and sufficed with ";" while economy names from the Frontier API are not. string tidiedName = edname.Replace("$economy_", "").Replace(";", ""); return(ResourceBasedLocalizedEDName <Economy> .FromEDName(tidiedName)); }
public new static DataScan FromEDName(string edname) { string normalizedEDName = normalizeEDName(edname); DataScan result = ResourceBasedLocalizedEDName <DataScan> .FromEDName(normalizedEDName); return(result); }
new public static SignalSource FromEDName(string from) { if (from.Contains("$")) { return(ResourceBasedLocalizedEDName <SignalSource> .FromEDName(from)); } return(new SignalSource(from)); }
new public static RingComposition FromEDName(string edname) { string normalizedEDName = edname .Replace("eRingClass_", "") .Replace("-", "") .Replace("Metalic", "Metallic"); return(ResourceBasedLocalizedEDName <RingComposition> .FromEDName(normalizedEDName)); }
new public static Government FromName(string from) { if (from is null) { return(None); } // EDSM uses a special string to describe engineering workshops, standardize here. from = from.Replace("Workshop (Engineer)", "engineer"); return(ResourceBasedLocalizedEDName <Government> .FromName(from)); }
public new static FactionState FromName(string from) { if (string.IsNullOrEmpty(from)) { return(None); } // EDSM uses "Terrorist Attack" rather than "Terrorism" var tidiedFrom = from .Replace("Terrorist Attack", "Terrorism"); return(ResourceBasedLocalizedEDName <FactionState> .FromName(tidiedFrom)); }
public new static SignalSource FromEDName(string from) { if (from != null) { if (from.Contains("$")) { string tidiedFrom = from .Replace("$", "") .Replace(";", ""); // Extract any sub-type from the name (e.g. $SAA_Unknown_Signal:#type=$SAA_SignalType_Geological;:#index=3; ) if (tidiedFrom.Contains(":#type=")) { string[] fromArray = tidiedFrom.Split(new[] { ":#type=" }, System.StringSplitOptions.None); tidiedFrom = fromArray[1]; } // Extract any index value which might be present and then strip the index value int indexResult = 0; if (tidiedFrom.Contains(":#index=")) { string[] fromArray = tidiedFrom.Split(new[] { ":#index=" }, System.StringSplitOptions.None); if (int.TryParse(fromArray[1], out indexResult)) { } tidiedFrom = fromArray[0]; } // Find our signal source SignalSource result = ResourceBasedLocalizedEDName <SignalSource> .FromEDName(tidiedFrom); // Include our index value with our result result.index = indexResult; return(result); } } return(null); }
new public MaterialCategory FromEDName(string edname) { string normalizedEDName = edname.Replace("$MICRORESOURCE_CATEGORY_", "").Replace(";", ""); return(ResourceBasedLocalizedEDName <MaterialCategory> .FromEDName(normalizedEDName)); }