コード例 #1
0
 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);
     }
 }
コード例 #2
0
        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);
            }
        }