예제 #1
0
            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);
                    }
                }
            }
예제 #2
0
 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);
     }
 }
예제 #3
0
 private ValveMaterialFile(string source)
 {
     _keyValues = KeyValues.Parse(source);
 }
예제 #4
0
 private ValveMaterialFile(Stream stream)
 {
     _keyValues = KeyValues.FromStream(stream);
 }