Exemple #1
0
        internal void ReadAll()
        {
            // Define all properties/fields which we want PropertyReader to read
            Dictionary <string, Type> PropMap = new Dictionary <string, Type> {
                { "AboutData", typeof(IAboutData) },
                { "Provider", typeof(IProvider) },
                { "Objects", typeof(IList <IBusObject>) },
                { "ChildObjects", typeof(IList <IBusObject>) },
                { "Interfaces", typeof(IList <IInterface>) },
                //{"Methods", typeof(IReadOnlyList<IMethod>) },
                //{"Annotations", typeof(IReadOnlyDictionary<string, string>) },
                //{"OutSignature", typeof(IList<DeviceProviders.ParameterInfo>) },
                //{"InSignature", typeof(IList<DeviceProviders.ParameterInfo>) },
                //{"Services", typeof(IList<IService>) }, // Services in Provider
                { nameof(Service), typeof(IService) },
            };

            var propertyReader = new PropertyReader
            {
                PropertyMap = PropMap,
                Out         = VariableListViewModel
            };

            propertyReader.Read(Service, nameof(Service));
        }
Exemple #2
0
        private static List <FavoriteConfigurationElement> TryImport(string filename)
        {
            using (var reader = new XmlTextReader(filename))
            {
                var propertyReader = new PropertyReader(reader);
                var context        = new ImportCodePlexTerminalsContext(propertyReader);
                while (propertyReader.Read())
                {
                    try
                    {
                        ReadProperty(context);
                    }
                    catch (Exception ex)
                    {
                        Log.Error("Unable to import some part of the CodePlex Terminals file.", ex);
                    }
                }

                return(context.Favorites);
            }
        }