示例#1
0
 public void Load(string fileName)
 {
     if (fileName == null)
     {
         throw new ArgumentNullException("fileName");
     }
     using (PropertiesReader pr = new PropertiesReader(
                StreamContext.FromFile(fileName))) {
         LoadCore(pr);
     }
 }
示例#2
0
        // TODO Needs work -- we want there to be as much fallback as
        // possible with parsing and stream loading.  Also probably
        // get encoding from content type

        public static object FromFile(Type componentType, string fileName)
        {
            if (componentType == null)
            {
                throw new ArgumentNullException("componentType");
            }
            if (string.IsNullOrEmpty(fileName))
            {
                throw Failure.NullOrEmptyString(nameof(fileName));
            }

            return(FromStreamContext(componentType, StreamContext.FromFile(fileName)));
        }