public override object Load(TextReader reader, Type instanceType)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");

            using (PropertiesReader pr = new PropertiesReader(reader)) {
                var items = pr.ReadToEnd().Select(t => new KeyValuePair<string, object>(t.Key, t.Value));

                if (typeof(IProperties).Equals(instanceType)
                    || typeof(IPropertyProviderExtension).Equals(instanceType)
                    || typeof(Properties).Equals(instanceType)
                    || typeof(IPropertyProvider).Equals(instanceType)) {
                    return new Properties(items);
                }

                return Activation.CreateInstance(instanceType,
                                                 items,
                                                 PopulateComponentCallback.Default,
                                                 ServiceProvider.Null);
            }
        }
 private void LoadCore(PropertiesReader reader)
 {
     try {
         RaiseEvents = false;
         while (reader.MoveToProperty()) {
             this.SetProperty(reader.QualifiedKey, reader.Value);
         }
     } finally {
         RaiseEvents = true;
     }
 }
        public void Load(StreamContext streamContext, Encoding encoding)
        {
            if (streamContext == null)
                throw new ArgumentNullException("streamContext");  // $NON-NLS-1

            using (PropertiesReader pr = new PropertiesReader(streamContext, encoding)) {
                LoadCore(pr);
            }
        }
        public void Load(Stream stream, Encoding encoding = null)
        {
            if (stream == null)
                throw new ArgumentNullException("stream");  // $NON-NLS-1

            using (StreamReader sr = Utility.MakeStreamReader(stream, encoding)) {
                using (PropertiesReader pr = new PropertiesReader(sr)) {
                    LoadCore(pr);
                }
            }
        }
 public void Load(string fileName)
 {
     if (fileName == null) { throw new ArgumentNullException("fileName"); } // $NON-NLS-1
     using (PropertiesReader pr = new PropertiesReader(
         StreamContext.FromFile(fileName))) {
         pr.AllowUriDereferences = true;
         LoadCore(pr);
     }
 }