private IConfiguration ConfigurationFromFile(IFile file) { try { var confStr = file.AsTextContent(); return(new Configuration(m_ConfigSerializer.Deserialize <Dictionary <string, object> >(confStr))); } catch (Exception ex) { throw new UserMessageException($"Failed to deserialize the configuration file '{file.Location.ToId()}'", ex); } }
private void ParseTextFile(IFile src, out string rawContent, out IMetadata data, out string layoutName) { try { FrontMatterParser.Parse(src.AsTextContent(), out rawContent, out data); layoutName = data.GetRemoveParameterOrDefault <string>(LAYOUT_VAR_NAME); } catch (Exception ex) { throw new UserMessageException($"Failed to deserialize the metadata from the '{src.Location.ToPath()}'", ex); } }