public VMTFile(Stream stream, String FileName = "") { this.FileName = FileName; if (stream == null) { MakeDefaultMaterial(); return; } KeyValues = KeyValues.FromStream(stream); if (KeyValues.Keys.Count() > 0 && KeyValues != null) { ShaderType = KeyValues.Keys.First(); //If shader is null, return if (string.IsNullOrEmpty(ShaderType)) { throw new FileLoadException(String.Format("Shader type is missing in material, skip parse", FileName)); } } else { throw new FileLoadException(String.Format("is missing any KeyValues data, skip parse", FileName)); } }