private void EnsureLoaded() { lock (this) { if (_entities != null) { return; } _entities = new List <Entity>(); var keyValues = KeyValues.ListFromStream(_bspFile.GetLumpStream(LumpType)); foreach (var entity in keyValues) { var className = entity["classname"]; Func <Entity> ctor; var ent = _sEntityCtors.TryGetValue(className, out ctor) ? ctor() : new Entity(); ent.Initialize(entity); _entities.Add(ent); } } }
public static bool TryParse(string value, out KeyValues result, KeyValuesFlags flags = KeyValuesFlags.Default) { try { result = Parse(value, flags); return(true); } catch { result = null; return(false); } }
private ValveMaterialFile(string source) { _keyValues = KeyValues.Parse(source); }
private ValveMaterialFile(Stream stream) { _keyValues = KeyValues.FromStream(stream); }