public Feature feature(string varName, IList <Feature> from = null) { Feature offs; Func <Feature, bool> search = ss => string.Equals(ss.name, varName, StringComparison.OrdinalIgnoreCase); if (from == null) { offs = FeaturesResources.FirstOrDefault(search) ?? FeaturesCountry.FirstOrDefault(search) ?? FeaturesWarfare.FirstOrDefault(search) ?? FeaturesSpecial.FirstOrDefault(search); } else { offs = from.First(search); } return(offs); // if(from == null) // offs = FeaturesResources // .Concat(FeaturesCountry) // .Concat(FeaturesWarfare) // .Concat(FeaturesSpecial) // .First(ss => ss.name.ToLower() == varName.ToLower()); // else // offs = from.First(ss => ss.name.ToLower() == varName.ToLower()); // return offs; }
public Feature FeatureByCategoryAndName(string category, string varname) { Feature feat; if (string.Equals(category, "warfare", StringComparison.OrdinalIgnoreCase)) { feat = FeaturesWarfare.First(s => s.name == varname); } else if (string.Equals(category, "country", StringComparison.OrdinalIgnoreCase)) { feat = FeaturesCountry.First(s => s.name == varname); } else if (string.Equals(category, "special", StringComparison.OrdinalIgnoreCase)) { feat = FeaturesSpecial.First(s => s.name == varname); } else { feat = FeaturesResources.First(s => s.name == varname); } return(feat); }
public string pointerStore(string varName) { Feature offs; Func <Feature, bool> search = ss => string.Equals(ss.name, varName, StringComparison.OrdinalIgnoreCase); offs = FeaturesResources.FirstOrDefault(search) ?? FeaturesCountry.FirstOrDefault(search) ?? FeaturesWarfare.FirstOrDefault(search) ?? FeaturesSpecial.FirstOrDefault(search); var p = DataPointer.First(s => s.id == offs.pointerId).pointer; var offset = String.IsNullOrEmpty(offs.offset) ? "" : "," + offs.offset; return(DataGame.ProcessName + "+" + p + offset); // Feature offs; // offs = FeaturesResources // .Concat(FeaturesCountry) // .Concat(FeaturesWarfare) // .Concat(FeaturesSpecial) // .First(ss => ss.name == varName); // // var p = DataPointer.First(s => // s.id == offs.pointerId).pointer; // var offset = String.IsNullOrEmpty(offs.offset) ? "" : "," + offs.offset; // // return DataGame.ProcessName + "+" + p + offset; }