Laden...

Ein einfaches PropertySystem

Erstellt von ernsti vor 16 Jahren Letzter Beitrag vor 16 Jahren 4.410 Views
E
ernsti Themenstarter:in
38 Beiträge seit 2005
vor 16 Jahren
Ein einfaches PropertySystem

Beschreibung:

Das Property-System dient zur globalen Verwaltung von DATEN (keinen Objekten)
Die Unterstützung zur Erzeugung von Properties über XML-Dateien kommt später noch dazu.

Es wird benötigt:
Eine einfache ObjectRegistry
Eine einfache ObjectFactory


using System;

namespace Nevada.Properties
{
    /// <summary>
    /// Describes a property
    /// </summary>
    public interface IProperty
    {
        /// <summary>
        /// Gets or sets the parent of the Property
        /// </summary>
        IProperty Parent
        {
            get;
            set;
        }
        /// <summary>
        /// Gets or sets the Name of the property
        /// </summary>
        string Name
        {
            get;
            set;
        }
        /// <summary>
        /// Imports the poperty
        /// </summary>
        /// <param name="propertyImporter">Propertyimporter</param>
        void ImportFrom (Nevada.IPropertyImporter propertyImporter);
        /// <summary>
        /// returns a string from the property
        /// </summary>
        /// <returns>string</returns>
        string ToString ();
    }
}


using System;

namespace Nevada.Properties
{
    /// <summary>
    /// Describes a Property-Collection
    /// </summary>
    interface IPropertyCollection
    {
        /// <summary>
        /// returns the property for given name
        /// </summary>
        /// <typeparam name="T">Type of the property</typeparam>
        /// <param name="propertyName">Name of the Property</param>
        /// <returns>Property for given Name</returns>
        T Get<T> (string propertyName);
        /// <summary>
        /// returns the value from the property for given name
        /// </summary>
        /// <typeparam name="T">Type of the value from the property</typeparam>
        /// <param name="propertyName">Name of the Property</param>
        /// <returns>Value from the property for given name</returns>
        T GetValue<T> (string propertyName);
        /// <summary>
        /// Sets the value from the property for given name
        /// </summary>
        /// <typeparam name="T">type of the value from the property</typeparam>
        /// <param name="propertyName">Name of the property</param>
        /// <param name="value">value to set</param>
        void SetValue<T> (string propertyName, T value) where T : System.IComparable<T>;
        /// <summary>
        /// sets a new property for given propertyname
        /// </summary>
        /// <param name="propertyName">propertyname</param>
        /// <param name="property">new property</param>
        void Set (string propertyName, Nevada.Properties.IProperty property);
        /// <summary>
        /// returns true, if the property for given name exists
        /// </summary>
        /// <param name="propertyName">propertyname</param>
        /// <returns>true, if the property exists</returns>
        bool Contains (string propertyName);
    }
}


using System;

namespace Nevada
{
    /// <summary>
    /// Describes a property importer
    /// </summary>
    public interface IPropertyImporter
    {
        /// <summary>
        /// Imports the next property
        /// </summary>
        /// <returns>imported property</returns>
        Nevada.Properties.IProperty ImportNextProperty ();
        /// <summary>
        /// Imports a property value
        /// </summary>
        /// <param name="property">Property</param>
        void ImportPropertyValue (Nevada.Properties.Property property);
    }
}



using System;

namespace Nevada.Properties
{
    /// <summary>
    /// represents the method which is handling the propertychanged-event
    /// </summary>
    public delegate void PropertyChangedEventHandler (object sender, PropertyChangedEventArgs e);
    /// <summary>
    /// this class contains the eventdata for the propertychanged-event
    /// </summary>
    public class PropertyChangedEventArgs : System.EventArgs
    {
        private object _oldValue;
        private object _newValue;
        private IProperty _property;
        /// <summary>
        /// returns the old value
        /// </summary>
        /// <typeparam name="T">Type of the value</typeparam>
        /// <returns>old Value</returns>
        public T GetOldValue<T> ()
        {
            return (T)this._oldValue;
        }
        /// <summary>
        /// returns the new value
        /// </summary>
        /// <typeparam name="T">Type of the value</typeparam>
        /// <returns>new Value</returns>
        public T GetNewValue<T> ()
        {
            return (T)this._newValue;
        }
        /// <summary>
        /// returns the property
        /// </summary>
        /// <typeparam name="T">Type of the property</typeparam>
        /// <returns>Property</returns>
        public T GetProperty<T> ()
        {
            return (T)this._property;
        }
        /// <summary>
        /// creates an new instance of the PropertyChangedEventArgs-class
        /// </summary>
        /// <param name="property">Property</param>
        /// <param name="oldValue">old Value</param>
        /// <param name="newValue">new Value</param>
        public PropertyChangedEventArgs (IProperty property, object oldValue, object newValue)
        {
            this._property = property;
            this._oldValue = oldValue;
            this._newValue = newValue;
        }
    }
}


using System;

namespace Nevada.Properties
{
    public class Property : IProperty
    {
        public static readonly Nevada.Collections.PropertyDictionary Properties = new Nevada.Collections.PropertyDictionary ();

        public event PropertyChangedEventHandler PropertyChanged;
        private IProperty _parent;
        private object _value;
        private string _name;
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                this._name = value;
            }
        }

        public Property ()
        {

        }

        public Property (object value)
        {
            this._value = value;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        public T Get<T> ()
        {
            return (T)this._value;
        }
        /// <summary>
        /// sets the value
        /// </summary>
        /// <typeparam name="T">type of the value</typeparam>
        /// <param name="value">value</param>
        public void Set<T> (T value) where T : System.IComparable<T>
        {
            if ( (this._value == null && value != null) || value.CompareTo ( (T)this._value) != 0)
            {
                T oldValue = default (T);
                if (this._value != null)
                {
                    oldValue = (T)this._value;
                }
                this._value = value;
                this.OnPropertyChanged (new PropertyChangedEventArgs (this, oldValue, this._value));
            }
        }

        /// <summary>
        /// gets or sets the parent of the Dictionary
        /// </summary>
        public IProperty Parent
        {
            get
            {
                return this._parent;
            }
            set
            {
                this._parent = value;
            }
        }
        /// <summary>
        /// raises the propertychanged-event
        /// </summary>
        /// <param name="e">contains event-data</param>
        protected virtual void OnPropertyChanged (PropertyChangedEventArgs e)
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged (this, e);
            }
        }
        public void ImportFrom (Nevada.IPropertyImporter propertyImporter)
        {
            propertyImporter.ImportPropertyValue (this);
        }

        public override string ToString ()
        {
            return this._value.ToString ();
        }
    }
}


using System;

namespace Nevada.Collections
{
    /// <summary>
    /// Stellt ein Object-Dictionary dar
    /// </summary>
    public class ObjectDictionary : System.Collections.Generic.Dictionary<string,object>
    {
        public T GetObject<T> (string objectName)
        {
            return (T)this[objectName];
        }
    }
}


using System;

namespace Nevada.Collections
{
    /// <summary>
    /// Stellt ein Property-Dictionary dar
    /// </summary>
    public class PropertyDictionary : Nevada.Properties.IPropertyCollection, Nevada.Properties.IProperty, System.Collections.Generic.IEnumerable<Nevada.Properties.IProperty>
    {
        private Nevada.Collections.PropertyMap _properties;
        /// <summary>
        /// is raised, if a property child is changed
        /// </summary>
        public event Nevada.Properties.PropertyChangedEventHandler ChildChanged;
        private string _name;
        /// <summary>
        /// gets or sets the name of the property - dictionary
        /// </summary>
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                this._name = value;
            }
        }
        private Nevada.Properties.IProperty _parent;
        /// <summary>
        /// gets or sets the parent of the Dictionary
        /// </summary>
        public Nevada.Properties.IProperty Parent
        {
            get
            {
                return this._parent;
            }
            set
            {
                this._parent = value;
            }
        }
        /// <summary>
        /// creates a new instance of the PropertyDictionary-class
        /// </summary>
        public PropertyDictionary ()
        {
            this._properties = new Nevada.Collections.PropertyMap ();
        }
        /// <summary>
        /// Adds a property to this Dictionary
        /// </summary>
        /// <param name="propertyName">name of the property</param>
        /// <param name="property">property</param>
        public void Add (string propertyName, Nevada.Properties.IProperty property)
        {
            System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (propertyName), "Invalid property Name !");
            System.Diagnostics.Debug.Assert (property != null, "Invalid property for property Name '" + propertyName + "' !");
            System.Diagnostics.Debug.Assert (!this._properties.ContainsKey (propertyName), "Property '" + propertyName + "' already exists in this Dictionary !");
            property.Parent = this;
            if (property is Nevada.Properties.Property)
            {
                ( (Nevada.Properties.Property)property).PropertyChanged += new Nevada.Properties.PropertyChangedEventHandler (ChildPropertyChanged);
            }
            this._properties.Add (propertyName, property);
        }

        /// <summary>
        /// Removes a property from the dictionary
        /// </summary>
        /// <param name="propertyName">propertyname of the property to remove</param>
        public void Remove (string propertyName)
        {
            System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (propertyName), "Invalid property Name !");
            System.Diagnostics.Debug.Assert (this._properties.ContainsKey (propertyName), "Property '" + propertyName + "' not exists in this Dictionary !");
            this._properties[propertyName].Parent = null;
            this._properties.Remove (propertyName);
        }
        /// <summary>
        /// returns true, if the dictionary contains the property for given name
        /// </summary>
        /// <param name="propertyName">name of the property</param>
        /// <returns>ture, if the dictionary contains the property for given name</returns>
        public bool Contains (string propertyName)
        {
            System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (propertyName), "Invalid property Name !");
            int delimetierIndex = propertyName.IndexOf ('.');
            bool result = false;
            if (delimetierIndex == -1)
            {
                result = this._properties.ContainsKey (propertyName);
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                if (this._properties.ContainsKey (firstString))
                {
                    result = ( (Nevada.Properties.IPropertyCollection)this._properties[firstString]).Contains (secondString);
                }
            }
            return result;
        }
        /// <summary>
        /// returns a value from a property
        /// </summary>
        /// <param name="propertyName">name of the property</param>
        /// <returns>value of type T</returns>
        public T GetValue<T> (string propertyName)
        {
            T result = default (T);
            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                System.Diagnostics.Debug.Assert (this._properties.ContainsKey (propertyName), "Missing property '" + propertyName + "' !");
                result = (T) ( (Nevada.Properties.Property)this._properties[propertyName]).Get<T> ();
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                System.Diagnostics.Debug.Assert (this._properties.ContainsKey (firstString), "Property not in this dictionary !");
                System.Diagnostics.Debug.Assert (this._properties[firstString] is Nevada.Properties.IPropertyCollection, "Property is not a propertyCollection !");
                result = ( (Nevada.Properties.IPropertyCollection)this._properties[firstString]).GetValue<T> (secondString);
            }
            return result;
        }
        /// <summary>
        /// Sets the value of a property
        /// </summary>
        /// <typeparam name="T">type of the propertyvalue</typeparam>
        /// <param name="propertyName">name of the property</param>
        /// <param name="value">property value</param>
        public void SetValue<T> (string propertyName, T value) where T : System.IComparable<T>
        {

            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                ( (Nevada.Properties.Property)this._properties[propertyName]).Set (value);
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                System.Diagnostics.Debug.Assert (this._properties.ContainsKey (firstString), "Property not in this dictionary !");
                System.Diagnostics.Debug.Assert (this._properties[firstString] is Nevada.Properties.IPropertyCollection, "Property is not a propertyCollection !");
                ( (Nevada.Properties.IPropertyCollection)this._properties[firstString]).SetValue<T> (secondString, value);
            }
        }

        /// <summary>
        /// returns a property
        /// </summary>
        /// <typeparam name="T">type of the property</typeparam>
        /// <param name="propertyName">name of the property</param>
        /// <returns>Property of type T</returns>
        public T Get<T> (string propertyName)
        {
            //System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (propertyName), "Invalid property Name !");
            //System.Diagnostics.Debug.Assert (this._properties.ContainsKey (propertyName), "Property '" + propertyName + "' is not in this Dictionary !");
            //System.Diagnostics.Debug.Assert (this._properties[propertyName] is T, "Property '" + propertyName + "' is not a Property !");
            T result = default (T);
            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                System.Diagnostics.Debug.Assert (this._properties.ContainsKey (propertyName), "Missing property '" + propertyName + "' !");
                result = (T)this._properties[propertyName];
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                System.Diagnostics.Debug.Assert (this._properties.ContainsKey (firstString), "Property not in this dictionary !");
                System.Diagnostics.Debug.Assert (this._properties[firstString] is Nevada.Properties.IPropertyCollection, "Property is not a propertyCollection !");
                result = ( (Nevada.Properties.IPropertyCollection)this._properties[firstString]).Get<T> (secondString);
            }
            return result;
        }

        public void Set (string propertyName, Nevada.Properties.IProperty property)
        {
            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                this._properties[propertyName] = property;
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                System.Diagnostics.Debug.Assert (this._properties.ContainsKey (firstString), "Property not in this dictionary !");
                System.Diagnostics.Debug.Assert (this._properties[firstString] is Nevada.Properties.IPropertyCollection, "Property is not a propertyCollection !");
                ( (Nevada.Properties.IPropertyCollection)this._properties[firstString]).Set (secondString,property);
            }
        }

        /// <summary>
        /// returns the enumerator for the list
        /// </summary>
        /// <returns>enumerator</returns>
        //public System.Collections.Generic.Dictionary<string,IProperty>.Enumerator GetEnumerator ()
        //{
        //    return this._properties.GetEnumerator ();
        //}

        public System.Collections.Generic.IEnumerator<Nevada.Properties.IProperty> GetEnumerator ()
        {
            return this._properties.Values.GetEnumerator ();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
        {
            return this._properties.GetEnumerator ();
        }

        private void ChildPropertyChanged (object sender, Nevada.Properties.PropertyChangedEventArgs e)
        {

        }
        protected void OnChildChanged (Nevada.Properties.PropertyChangedEventArgs e)
        {
            if (this.ChildChanged != null)
            {
                this.ChildChanged (this, e);
            }
        }
        public void ImportFrom (Nevada.IPropertyImporter propertyImporter)
        {
            string name = this.Name;
            Nevada.Properties.IProperty property = null;

            do
            {
                property = propertyImporter.ImportNextProperty ();
                if (property != null)
                {
                    this.Add (property.Name, property);
                }
            } while (property != null);
        }
    }
}


using System;

namespace Nevada.Collections
{
    public class PropertyList : Nevada.Properties.IPropertyCollection, Nevada.Properties.IProperty, System.Collections.Generic.IEnumerable<Nevada.Properties.IProperty>
    {
        private System.Collections.Generic.List<Nevada.Properties.IProperty> _properties;
        private string _name;
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                this._name = value;
            }
        }
        private Nevada.Properties.IProperty _parent;
        /// <summary>
        /// gets or sets the parent of the Dictionary
        /// </summary>
        public Nevada.Properties.IProperty Parent
        {
            get
            {
                return this._parent;
            }
            set
            {
                this._parent = value;
            }
        }
        /// <summary>
        /// returns the Number of listentries
        /// </summary>
        public int Count
        {
            get
            {
                return this._properties.Count;
            }
        }

        /// <summary>
        /// creates a new instance of the PropertyDictionary-class
        /// </summary>
        public PropertyList ()
        {
            this._properties = new System.Collections.Generic.List<Nevada.Properties.IProperty> ();
        }
        /// <summary>
        /// Adds a property to this Dictionary
        /// </summary>
        /// <param name="propertyName">name of the property</param>
        /// <param name="property">property</param>
        public void Add (Nevada.Properties.IProperty property)
        {
            System.Diagnostics.Debug.Assert (property != null, "Invalid property !");
            System.Diagnostics.Debug.Assert (property.Parent == null, "Property is already registered to another Parent !");
            property.Parent = this;
            this._properties.Add (property);
        }
        /// <summary>
        /// Removes a property from the dictionary
        /// </summary>
        /// <param name="propertyName">propertyname of the property to remove</param>
        public void Remove (Nevada.Properties.IProperty property)
        {
            System.Diagnostics.Debug.Assert (property != null, "Invalid property to remove !");
            System.Diagnostics.Debug.Assert (this._properties.Contains (property), "Property not exists in this List !");
            property.Parent = null;
            this._properties.Remove (property);
        }
        /// <summary>
        /// Clears the property list
        /// </summary>
        public void Clear ()
        {
            foreach (Nevada.Properties.IProperty property in this._properties)
            {
                property.Parent = null;
            }
            this._properties.Clear ();
        }
        /// <summary>
        /// Removes a Property at the given Index
        /// </summary>
        /// <param name="index"></param>
        public void RemoveAt (int index)
        {
            this._properties.RemoveAt (index);
        }
        /// <summary>
        /// returns a value from a property
        /// </summary>
        /// <typeparam name="T">type of value</typeparam>
        /// <param name="propertyName">name of the property</param>
        /// <returns>value of type T</returns>
        public T GetValue<T> (int index)
        {
            System.Diagnostics.Debug.Assert (this._properties[index] is Nevada.Properties.Property, "Property is not a Property !");
            return ( (Nevada.Properties.Property)this._properties[index]).Get<T> ();
        }

        public T GetValue<T> (string propertyName)
        {
            T result = default (T);
            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                result = (T) ( (Nevada.Properties.Property)this._properties[System.Convert.ToInt32 (propertyName)]).Get<T> ();
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                System.Diagnostics.Debug.Assert (this._properties[System.Convert.ToInt32 (firstString)] is Nevada.Properties.IPropertyCollection, "Property is not a propertyCollection !");
                result = ( (Nevada.Properties.IPropertyCollection)this._properties[System.Convert.ToInt32 (firstString)]).GetValue<T> (secondString);
            }
            return result;
        }
        public void SetValue<T> (string propertyName, T value) where T : System.IComparable<T>
        {
            T result = default (T);
            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                ( (Nevada.Properties.Property)this._properties[System.Convert.ToInt32 (propertyName)]).Set<T> (value);
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                System.Diagnostics.Debug.Assert (this._properties[System.Convert.ToInt32 (firstString)] is Nevada.Properties.IPropertyCollection, "Property is not a propertyCollection !");
                ( (Nevada.Properties.IPropertyCollection)this._properties[System.Convert.ToInt32 (firstString)]).SetValue<T> (secondString, value);
            }
        }
        public void SetValue<T> (int index, T value) where T : System.IComparable<T>
        {
            this.SetValue<T> (index.ToString (), value);
        }

        /// <summary>
        /// returns a property
        /// </summary>
        /// <typeparam name="T">type of the property</typeparam>
        /// <param name="propertyName">name of the property</param>
        /// <returns>Property of type T</returns>
        public T Get<T> (int index)
        {
            System.Diagnostics.Debug.Assert (this._properties[index] is T, "Property is not a Property !");
            return (T)this._properties[index];
        }

        public T Get<T> (string propertyName)
        {
            //System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (System.Convert.ToInt32 (propertyName)), "Invalid property Name !");
            //System.Diagnostics.Debug.Assert (this._properties.ContainsKey (System.Convert.ToInt32 (propertyName)), "Property '" + propertyName + "' is not in this Dictionary !");
            //System.Diagnostics.Debug.Assert (this._properties[System.Convert.ToInt32 (propertyName)] is T, "Property '" + propertyName + "' is not a Property !");
            T result = default (T);
            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                result = (T)this._properties[System.Convert.ToInt32 (propertyName)];
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                //                System.Diagnostics.Debug.Assert (this._properties.ContainsKey (firstString),"Property not in this dictionary !");
                //                System.Diagnostics.Debug.Assert (this._properties[firstString] is Nevada.IPropertyCollection, "Property is not a propertyCollection !");
                result = ( (Nevada.Properties.IPropertyCollection)this._properties[System.Convert.ToInt32 (firstString)]).Get<T> (secondString);
            }
            return result;
        }

        /// <summary>
        /// returns the enumerator for the list
        /// </summary>
        /// <returns>enumerator</returns>
        public System.Collections.Generic.IEnumerator<Nevada.Properties.IProperty> GetEnumerator ()
        {
            return this._properties.GetEnumerator ();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
        {
            return this._properties.GetEnumerator ();
        }
        public void ImportFrom (Nevada.IPropertyImporter propertyImporter)
        {
            string name = this.Name;
            Nevada.Properties.IProperty property = null;
            do
            {
                property = propertyImporter.ImportNextProperty ();
                if (property != null)
                {
                    this.Add (property);
                }
            } while (property != null);
        }

        public bool Contains (string propertyName)
        {
            System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (propertyName), "Invalid property Name !");
            int delimetierIndex = propertyName.IndexOf ('.');
            bool result = false;
            if (delimetierIndex == -1)
            {
                result = System.Convert.ToInt32 (propertyName) < this._properties.Count;
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                if (System.Convert.ToInt32 (firstString) < this._properties.Count)
                {
                    result = ( (Nevada.Properties.IPropertyCollection)this._properties[System.Convert.ToInt32 (firstString)]).Contains (secondString);
                }
            }
            return result;
        }
        public void Set (string propertyName, Nevada.Properties.IProperty property)
        { }
    }
}



using System;

namespace Nevada.Collections
{
    public class PropertyList : Nevada.Properties.IPropertyCollection, Nevada.Properties.IProperty, System.Collections.Generic.IEnumerable<Nevada.Properties.IProperty>
    {
        private System.Collections.Generic.List<Nevada.Properties.IProperty> _properties;
        private string _name;
        public string Name
        {
            get
            {
                return this._name;
            }
            set
            {
                this._name = value;
            }
        }
        private Nevada.Properties.IProperty _parent;
        /// <summary>
        /// gets or sets the parent of the Dictionary
        /// </summary>
        public Nevada.Properties.IProperty Parent
        {
            get
            {
                return this._parent;
            }
            set
            {
                this._parent = value;
            }
        }
        /// <summary>
        /// returns the Number of listentries
        /// </summary>
        public int Count
        {
            get
            {
                return this._properties.Count;
            }
        }

        /// <summary>
        /// creates a new instance of the PropertyDictionary-class
        /// </summary>
        public PropertyList ()
        {
            this._properties = new System.Collections.Generic.List<Nevada.Properties.IProperty> ();
        }
        /// <summary>
        /// Adds a property to this Dictionary
        /// </summary>
        /// <param name="propertyName">name of the property</param>
        /// <param name="property">property</param>
        public void Add (Nevada.Properties.IProperty property)
        {
            System.Diagnostics.Debug.Assert (property != null, "Invalid property !");
            System.Diagnostics.Debug.Assert (property.Parent == null, "Property is already registered to another Parent !");
            property.Parent = this;
            this._properties.Add (property);
        }
        /// <summary>
        /// Removes a property from the dictionary
        /// </summary>
        /// <param name="propertyName">propertyname of the property to remove</param>
        public void Remove (Nevada.Properties.IProperty property)
        {
            System.Diagnostics.Debug.Assert (property != null, "Invalid property to remove !");
            System.Diagnostics.Debug.Assert (this._properties.Contains (property), "Property not exists in this List !");
            property.Parent = null;
            this._properties.Remove (property);
        }
        /// <summary>
        /// Clears the property list
        /// </summary>
        public void Clear ()
        {
            foreach (Nevada.Properties.IProperty property in this._properties)
            {
                property.Parent = null;
            }
            this._properties.Clear ();
        }
        /// <summary>
        /// Removes a Property at the given Index
        /// </summary>
        /// <param name="index"></param>
        public void RemoveAt (int index)
        {
            this._properties.RemoveAt (index);
        }
        /// <summary>
        /// returns a value from a property
        /// </summary>
        /// <typeparam name="T">type of value</typeparam>
        /// <param name="propertyName">name of the property</param>
        /// <returns>value of type T</returns>
        public T GetValue<T> (int index)
        {
            System.Diagnostics.Debug.Assert (this._properties[index] is Nevada.Properties.Property, "Property is not a Property !");
            return ( (Nevada.Properties.Property)this._properties[index]).Get<T> ();
        }

        public T GetValue<T> (string propertyName)
        {
            T result = default (T);
            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                result = (T) ( (Nevada.Properties.Property)this._properties[System.Convert.ToInt32 (propertyName)]).Get<T> ();
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                System.Diagnostics.Debug.Assert (this._properties[System.Convert.ToInt32 (firstString)] is Nevada.Properties.IPropertyCollection, "Property is not a propertyCollection !");
                result = ( (Nevada.Properties.IPropertyCollection)this._properties[System.Convert.ToInt32 (firstString)]).GetValue<T> (secondString);
            }
            return result;
        }
        public void SetValue<T> (string propertyName, T value) where T : System.IComparable<T>
        {
            T result = default (T);
            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                ( (Nevada.Properties.Property)this._properties[System.Convert.ToInt32 (propertyName)]).Set<T> (value);
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                System.Diagnostics.Debug.Assert (this._properties[System.Convert.ToInt32 (firstString)] is Nevada.Properties.IPropertyCollection, "Property is not a propertyCollection !");
                ( (Nevada.Properties.IPropertyCollection)this._properties[System.Convert.ToInt32 (firstString)]).SetValue<T> (secondString, value);
            }
        }
        public void SetValue<T> (int index, T value) where T : System.IComparable<T>
        {
            this.SetValue<T> (index.ToString (), value);
        }

        /// <summary>
        /// returns a property
        /// </summary>
        /// <typeparam name="T">type of the property</typeparam>
        /// <param name="propertyName">name of the property</param>
        /// <returns>Property of type T</returns>
        public T Get<T> (int index)
        {
            System.Diagnostics.Debug.Assert (this._properties[index] is T, "Property is not a Property !");
            return (T)this._properties[index];
        }

        public T Get<T> (string propertyName)
        {
            //System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (System.Convert.ToInt32 (propertyName)), "Invalid property Name !");
            //System.Diagnostics.Debug.Assert (this._properties.ContainsKey (System.Convert.ToInt32 (propertyName)), "Property '" + propertyName + "' is not in this Dictionary !");
            //System.Diagnostics.Debug.Assert (this._properties[System.Convert.ToInt32 (propertyName)] is T, "Property '" + propertyName + "' is not a Property !");
            T result = default (T);
            int delimetierIndex = propertyName.IndexOf ('.');
            if (delimetierIndex == -1)
            {
                result = (T)this._properties[System.Convert.ToInt32 (propertyName)];
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                //                System.Diagnostics.Debug.Assert (this._properties.ContainsKey (firstString),"Property not in this dictionary !");
                //                System.Diagnostics.Debug.Assert (this._properties[firstString] is Nevada.IPropertyCollection, "Property is not a propertyCollection !");
                result = ( (Nevada.Properties.IPropertyCollection)this._properties[System.Convert.ToInt32 (firstString)]).Get<T> (secondString);
            }
            return result;
        }

        /// <summary>
        /// returns the enumerator for the list
        /// </summary>
        /// <returns>enumerator</returns>
        public System.Collections.Generic.IEnumerator<Nevada.Properties.IProperty> GetEnumerator ()
        {
            return this._properties.GetEnumerator ();
        }

        System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator ()
        {
            return this._properties.GetEnumerator ();
        }
        public void ImportFrom (Nevada.IPropertyImporter propertyImporter)
        {
            string name = this.Name;
            Nevada.Properties.IProperty property = null;
            do
            {
                property = propertyImporter.ImportNextProperty ();
                if (property != null)
                {
                    this.Add (property);
                }
            } while (property != null);
        }

        public bool Contains (string propertyName)
        {
            System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (propertyName), "Invalid property Name !");
            int delimetierIndex = propertyName.IndexOf ('.');
            bool result = false;
            if (delimetierIndex == -1)
            {
                result = System.Convert.ToInt32 (propertyName) < this._properties.Count;
            }
            else
            {
                string firstString = propertyName.Substring (0, delimetierIndex);
                string secondString = propertyName.Substring (delimetierIndex + 1);
                if (System.Convert.ToInt32 (firstString) < this._properties.Count)
                {
                    result = ( (Nevada.Properties.IPropertyCollection)this._properties[System.Convert.ToInt32 (firstString)]).Contains (secondString);
                }
            }
            return result;
        }
        public void Set (string propertyName, Nevada.Properties.IProperty property)
        { }
    }
}


using System;

namespace Nevada.Collections
{
    public class PropertyMap : System.Collections.Generic.Dictionary<string, Nevada.Properties.IProperty>
    {
    }
}


Beispiel:


                Nevada.Collections.PropertyList propertyList = new Nevada.Collections.PropertyList ();
                propertyList.Add (new Nevada.Properties.Property (12));
                propertyList.Add (new Nevada.Properties.Property (11));
                propertyList.Add (new Nevada.Properties.Property (14));

                Nevada.Collections.PropertyDictionary propertyDictionary2 = new Nevada.Collections.PropertyDictionary ();
                propertyDictionary2.Add ("NochEinStringWert",new Nevada.Properties.Property ("Coole Sache !"));
                // Ein Dictionary erstellen
                Nevada.Collections.PropertyDictionary propertyDictionary = new Nevada.Collections.PropertyDictionary ();
                // und mit werten füllen... 
                propertyDictionary.Add ("IntegerWert", new Nevada.Properties.Property (12));
                propertyDictionary.Add ("floatWert", new Nevada.Properties.Property (11.0f));
                propertyDictionary.Add ("StringWert", new Nevada.Properties.Property ("Hallo Welt !"));
                // das propertydicitionary kann auch PropertyDictionary bzw. PropertyList angegeben werden:
                propertyDictionary.Add ("PropDict",propertyDictionary2);
                propertyDictionary.Add ("PropList",propertyList);

                Nevada.Properties.Property.Properties.Add ("hallo", propertyDictionary);
                Nevada.Properties.Property.Properties.Add ("Int1", new Nevada.Properties.Property (12));

                System.Console.WriteLine ("System.Werte.Int1: " + Nevada.Properties.Property.Properties.GetValue<int> ("Int1"));
                Nevada.Collections.PropertyDictionary dict = Nevada.Properties.Property.Properties.Get<Nevada.Collections.PropertyDictionary> ("hallo");
                System.Console.WriteLine ("Float wert vor änderung: "+ dict.GetValue<float> ("floatWert"));
                dict.SetValue ("floatWert", 13.3f);
                System.Console.WriteLine ("Float wert nach änderung: " + dict.GetValue<float> ("floatWert"));
                Nevada.Collections.PropertyList liste = dict.Get<Nevada.Collections.PropertyList> ("PropList");
                for (int i = 0; i < liste.Count; ++i)
                {
                    System.Console.WriteLine (liste.GetValue<int> (i));
                }
                liste.SetValue (0, 22);
                for (int i = 0; i < liste.Count; ++i)
                {
                    System.Console.WriteLine (liste.GetValue<int> (i));
                }
                System.Console.WriteLine (Nevada.Properties.Property.Properties.GetValue<string> ("hallo.PropDict.NochEinStringWert"));
                Nevada.Properties.Property.Properties.SetValue ("hallo.PropDict.NochEinStringWert", "Coole Sache, Parker !");
                System.Console.WriteLine (Nevada.Properties.Property.Properties.GetValue<string> ("hallo.PropDict.NochEinStringWert"));

Die Grundlage für das Importieren von Properties und Objekten, usw...


using System;

namespace Nevada.Xml
{
    public class XmlDocument
    {
        public void Load (string fileName)
        {
            try
            {
                System.Xml.XmlDocument xmlDocument = new System.Xml.XmlDocument ();
                
                xmlDocument.Load (fileName);
                foreach (System.Xml.XmlNode node in xmlDocument.ChildNodes)
                {
                    if (node.NodeType == System.Xml.XmlNodeType.Element)
                    {
                        foreach (System.Xml.XmlNode innerNode in node.ChildNodes)
                        {
                            if (innerNode.NodeType == System.Xml.XmlNodeType.Element)
                            {
                                System.Xml.XmlElement element = (System.Xml.XmlElement)innerNode;

                                    switch (innerNode.Name)
                                    {
                                        case "properties":
                                            XmlPropertyImporter.ConfigureProperties (element);
                                            break;

                                        case "objectFactory":
                                            XmlObjectFactoryImporter.ConfigureAliasMap (element);
                                            break;
                                        case "objects":
                                            try
                                            {
                                                XmlObjectImporter.ConfigureObjects (element);
                                            }
                                            catch (System.Exception ex)
                                            {
                                                System.Console.WriteLine (ex.Message);
                                                throw ex;
                                            }
                                            break;
                                        case "debugBreak":
                                            if (System.Diagnostics.Debugger.IsAttached)
                                            {
                                                System.Diagnostics.Debugger.Break ();
                                            }
                                            break;
                                    }
                       
                            }
                        }
                    }
                }
            }
            catch (System.Exception ex)
            {
                System.Console.WriteLine (ex.Message);
            }
        }
    }
}



using System;

namespace Nevada.Xml
{
    public class XmlObjectFactoryImporter
    {
        public static void ConfigureAliasMap (System.Xml.XmlNode aliasNode)
        {
            foreach (System.Xml.XmlNode node in aliasNode)
            {
                if (node.NodeType == System.Xml.XmlNodeType.Element)
                {
                    switch (node.Name)
                    {
                        case "debugBreak":
                            if (System.Diagnostics.Debugger.IsAttached)
                            {
                                System.Diagnostics.Debugger.Break ();
                            }
                            break;
                        case "alias":
                            System.Xml.XmlElement element = (System.Xml.XmlElement)node;
                            System.Diagnostics.Debug.Assert (element.HasAttribute ("typeName"), "Missing Attribute 'typeName' !");
                            System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (element.Attributes["typeName"].Value), "Invalid Attribute 'typeName' !");
                            System.Diagnostics.Debug.Assert (element.HasAttribute ("aliasName"), "Missing Attribute 'aliasName' !");
                            System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (element.Attributes["aliasName"].Value), "Invalid Attribute 'aliasName' !");
                            string typeName = element.Attributes["typeName"].Value;
                            string aliasName = element.Attributes["aliasName"].Value;
                            Nevada.Core.ObjectFactory.Instance.AddAliasName (typeName, aliasName);
                            break;
                    }
                }
            }
        }
    }
}


using System;

namespace Nevada.Xml
{
    public class XmlObjectImporter
    {
        public static void ConfigureObjects (System.Xml.XmlNode objectNode)
        {
            foreach (System.Xml.XmlNode node in objectNode.ChildNodes)
            {
                if (node.NodeType == System.Xml.XmlNodeType.Element)
                {
                    //TODO
                    Nevada.Core.ObjectRegistry registry = Nevada.Core.ObjectRegistry.Instance;

                    switch (node.Name)
                    {
                        case "debugBreak":
                            if (System.Diagnostics.Debugger.IsAttached)
                            {
                                System.Diagnostics.Debugger.Break ();
                            }
                            break;
                        case "object":
                            try
                            {
                                ConfigureObject (node, registry);
                            }
                            catch (System.Exception ex)
                            {
                                System.Console.WriteLine (ex.Message);
                                throw ex;
                            }
                            break;
                        case "scope":
                            ConfigureScope (node, registry);
                            break;
                    }
                }
            }
        }

        private static void ConfigureScope (System.Xml.XmlNode scopeNode, Nevada.Core.ObjectRegistry registry)
        {
            if (scopeNode.NodeType == System.Xml.XmlNodeType.Element)
            {
                string scopeName = scopeNode.Attributes["name"].Value;
                registry.Add (scopeName);
                registry = registry.Get<Nevada.Core.ObjectRegistry> (scopeName);

                foreach (System.Xml.XmlNode node in scopeNode.ChildNodes)
                {
                    if (node.NodeType == System.Xml.XmlNodeType.Element)
                    {
                        switch (node.Name)
                        {
                            case "scope":
                                ConfigureScope (node,registry);
                                break;
                            case "object":
                                try
                                {
                                    ConfigureObject (node, registry);
                                }
                                catch (System.Exception ex)
                                {
                                    System.Console.WriteLine (ex.Message);
                                    throw ex;
                                }
                                break;
                        }
                    }
                }
            }
        }

        private static void ConfigureObject (System.Xml.XmlNode objectNode, Nevada.Core.ObjectRegistry registry)
        {
            if (objectNode.NodeType == System.Xml.XmlNodeType.Element)
            {   
                System.Xml.XmlElement element = (System.Xml.XmlElement)objectNode;
                System.Diagnostics.Debug.Assert (element.HasAttribute ("name"), "Missing Attribute 'name' !");
                System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (element.Attributes["name"].Value), "Invalid Attribute value in 'type' !");
                string name = element.Attributes["name"].Value;
                string type = element.Attributes["type"].Value;
                try
                {
                    object obj = CreateObject (objectNode);
                    registry.Add (name, obj);
                }
                catch (System.Exception ex)
                {
                    System.Console.WriteLine (ex.Message+" Name: "+name);
                    throw ex;
                }
            }
        }

        public static object CreateObject (System.Xml.XmlNode node)
        {
            object result = null;
            if (node.NodeType == System.Xml.XmlNodeType.Element)
            {
                System.Xml.XmlElement element = (System.Xml.XmlElement)node;
                System.Diagnostics.Debug.Assert (element.HasAttribute ("type"), "Missing Attribute 'name' !");
                System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (element.Attributes["type"].Value), "Invalid Attribute value in 'type' !");
                Nevada.Collections.PropertyDictionary propertiesDictionary = null;
                if (element.HasChildNodes)
                {
                    if (element.ChildNodes[0].NodeType == System.Xml.XmlNodeType.Element)
                    {
                        System.Xml.XmlElement innerElement = (System.Xml.XmlElement)element.ChildNodes[0];
                        switch (innerElement.Name)
                        {
                            case "context":
                                propertiesDictionary = new Nevada.Collections.PropertyDictionary ();
                                Nevada.IPropertyImporter propertyImporter = new XmlPropertyReader (innerElement);
                                propertiesDictionary.ImportFrom (propertyImporter);
                                break;
                            case "contextLookup":
                                System.Diagnostics.Debug.Assert (element.HasAttribute ("name"), "Missing Attribute 'name' !");
                                System.Diagnostics.Debug.Assert (!string.IsNullOrEmpty (element.Attributes["name"].Value), "Invalid Attribute value in 'type' !");
        
                                string name = innerElement.Attributes["name"].Value;
                                propertiesDictionary = Nevada.Properties.Property.Properties.Get<Nevada.Collections.PropertyDictionary> (name);
                                break;
                            case "debugBreak":
                                if (System.Diagnostics.Debugger.IsAttached)
                                {
                                    System.Diagnostics.Debugger.Break ();
                                }
                                break;
                        }
                    }
                }
                result = Nevada.Core.ObjectFactory.Instance.Create<object> (element.Attributes["type"].Value, propertiesDictionary);
            }
            return result;
        }
    }
}



using System;
using System.Collections.Generic;
using System.Text;

namespace Nevada.Xml
{
    public class XmlPropertyImporter
    {
        public static void ConfigureProperties (System.Xml.XmlNode objectNode)
        {
            Nevada.Xml.XmlPropertyReader propertyReader = new XmlPropertyReader ( (System.Xml.XmlElement)objectNode);
            Nevada.Collections.PropertyDictionary dictionary = new Nevada.Collections.PropertyDictionary ();
            dictionary.ImportFrom (propertyReader);
            System.Collections.Generic.IEnumerator<Nevada.Properties.IProperty> enumerator = dictionary.GetEnumerator ();

            while (enumerator.MoveNext ())
            {
                Nevada.Properties.IProperty property = enumerator.Current;
                string propertyName = property.Name;
                if (!Nevada.Properties.Property.Properties.Contains (propertyName))
                {
                    Nevada.Properties.Property.Properties.Add (propertyName, property);
                }
            }
        }
    }
}



using System;

namespace Nevada.Xml
{
    public class XmlPropertyReader : Nevada.IPropertyImporter
    {
        private int _numberOfProperties;
        private int _currentCount;
        private System.Xml.XmlElement _xmlElement;

        public XmlPropertyReader (System.Xml.XmlElement xmlElement)
        {
            this._currentCount = 0;
            this._numberOfProperties = xmlElement.ChildNodes.Count;
            this._xmlElement = xmlElement;
        }

        public Nevada.Properties.IProperty ImportNextProperty ()
        {
            Nevada.Properties.IProperty property = null;
            if (this._currentCount < this._numberOfProperties)
            {
                property = this.CreateProperty ( (System.Xml.XmlElement)this._xmlElement.ChildNodes[this._currentCount]);
                string propertyName = "";
                if (property != null)
                {

                    if (string.IsNullOrEmpty (propertyName))
                    {
                        try
                        {
                            propertyName = this._xmlElement.ChildNodes[this._currentCount].Attributes["name"].Value;
                        }
                        catch (System.Exception e)
                        {

                        }

                    }
                    if (!string.IsNullOrEmpty (propertyName))
                    {
                        property.Name = propertyName;
                    }
                    //this._nextIndex = this._currentIndex;
                    if (property is Nevada.Properties.Property)
                    {
                        property.ImportFrom (new XmlPropertyReader ( (System.Xml.XmlElement)this._xmlElement.ChildNodes[this._currentCount]));
                    }
                    else
                    {
                        property.ImportFrom (new XmlPropertyReader ( (System.Xml.XmlElement)this._xmlElement.ChildNodes[this._currentCount]));
                    }
                    
                    ++this._currentCount;
                }
            }
            return property;
        }

        public Nevada.Properties.IProperty CreateProperty (System.Xml.XmlElement xmlElement)
        {
            string nodeName = xmlElement.Name;
            Nevada.Properties.IProperty property = null;
            switch (nodeName)
            {
                case "debugBreak":
                    if (System.Diagnostics.Debugger.IsAttached)
                    {
                        System.Diagnostics.Debugger.Break ();
                    }
                    break;
                case "context":
                    property = new Nevada.Collections.PropertyDictionary ();
                    break;
                case "array":
                    property = new Nevada.Collections.PropertyList ();
                    break;
                default:
                    property = new Nevada.Properties.Property ();
                    break;
            }
            return property;
        }

        public void ImportPropertyValue (Nevada.Properties.Property property)
        {
            string type = this._xmlElement.Name;
            string value = this._xmlElement.Attributes["value"].Value;
            switch (type)
            {
                case "debugBreak":
                    if (System.Diagnostics.Debugger.IsAttached)
                    {
                        System.Diagnostics.Debugger.Break ();
                    }
                    break;
                case "string":
                    property.Set (System.Convert.ToString (value));
                    break;
                case "short":
                    property.Set (System.Convert.ToInt16 (value));
                    break;
                case "int":
                    property.Set (System.Convert.ToInt32 (value));
                    break;  
                case "long":
                    property.Set (System.Convert.ToInt64 (value));
                    break;
                case "ushort":
                    property.Set (System.Convert.ToUInt16 (value));
                    break;
                case "uint":
                    property.Set (System.Convert.ToUInt32 (value));
                    break;
                case "ulong":
                    property.Set (System.Convert.ToUInt64 (value));
                    break;
                case "single":
                case "float":
                    property.Set (System.Convert.ToSingle (value));
                    break;
                case "double":
                    property.Set (System.Convert.ToDouble (value));
                    break;
                case "decimal":
                    property.Set (System.Convert.ToDecimal (value));
                    break;
                case "dateTime":
                    property.Set (System.Convert.ToDateTime (value));
                    break;
                case "byte":
                    property.Set (System.Convert.ToByte (value));
                    break;
                case "sbyte":
                    property.Set (System.Convert.ToSByte (value));
                    break;
                case "bool":
                    property.Set (System.Convert.ToBoolean (value));
                    break;
            }
        }

    }

}



using System;

namespace Nevada
{
    public class Config
    {
        /// <summary>
        /// Loads a config from an xmlDocument
        /// </summary>
        /// <param name="fileName">path and name of the xml-document</param>
        public static void Load (string fileName)
        {
            Nevada.Xml.XmlDocument xmlDocument = new Nevada.Xml.XmlDocument ();
            xmlDocument.Load (fileName);
        }
    }
}


Beispielklasse zum Loggen


using System;

namespace Nevada.Logging
{
    public class EventLog :  System.IDisposable
    {
        System.Diagnostics.EventLog _eventlog;

        public EventLog (string logName,string source)
        {
             this._eventlog = new System.Diagnostics.EventLog (logName);
             this._eventlog.Source = source;
             if (!System.Diagnostics.EventLog.SourceExists (source))
             {
                 System.Diagnostics.EventLog.CreateEventSource (source,logName);
             }
        }

        public void Clear ()
        {
            this._eventlog.Clear ();
        }

        public EventLog (Nevada.Collections.PropertyDictionary propertyDictionary) : this (propertyDictionary.GetValue<string> ("logName"),propertyDictionary.GetValue<string> ("source"))
        {
        }

        public void Log (int level, string category, params string[] messages)
        {
            string message = "";
            foreach (string m in messages)
            {
                message+=m;
            }
            this._eventlog.WriteEntry (message);
        }
        public string NewLine ()
        {
            return System.Environment.NewLine;
        }

        public void Dispose ()
        {
            Nevada.Utilities.Destroy (ref this._eventlog);
        }
    }
}





<?xml version="1.0" encoding="utf-8"?>
<Config>
  <!-- Aliasnamen für die Datentypen für die Object-Factory -->
  <objectFactory>
    <aliasMap>
      <alias typeName="System.Boolean" aliasName="bool"/>
      <alias typeName="System.Int32" aliasName="int"/>
      <alias typeName="System.Int16" aliasName="short"/>
      <alias typeName="System.Int64" aliasName="long"/>
      <alias typeName="System.UInt16" aliasName="ushort"/>
      <alias typeName="System.UInt32" aliasName="uint"/>
      <alias typeName="System.UInt64" aliasName="ulong"/>
      <alias typeName="System.Byte" aliasName="byte"/>
      <alias typeName="System.Double" aliasName="double"/>
      <alias typeName="System.Single" aliasName="float"/>
      <alias typeName="System.SByte" aliasName="sbyte"/>
      <alias typeName="System.String" aliasName="string"/>
      <alias typeName="System.Decimal" aliasName="decimal"/>
      <alias typeName="System.DateTime" aliasName="DateTime"/>
      <alias typeName="System.Drawing.Point" aliasName="Point"/>
      <alias typeName="System.Drawing.Size" aliasName="Size"/>
    </aliasMap>
  </objectFactory> 
  <objects>
    <object name ="System.Logging.EventLog1" type="Nevada.Logging.EventLog, Nevada, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
      <context>
        <string name ="source" value="nevadalog"/>
        <string name ="logName" value ="testlog"/>
      </context>
    </object>   
<!-- optionaler debugbreak -->
<debugBreak/>
 <object name ="System.Logging.EventLog2" type="Nevada.Logging.EventLog, Nevada, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null">
      <context>
        <string name ="source" value="nevada"/>
        <string name ="logName" value ="test"/>
      </context>
    </object>
  </objects>
  <properties>
    <context name="FertigerKontext">
      <string name="message" value ="Fertiger Kontext laesst gruessen !"/>
      <context name="kontext">
        <int name="integer" value ="12"/>
        <float name ="float" value ="13.0"/>
        <string name="name" value="bla"/>
        <array name="array">
          <int value ="12"/>
          <int value= "13"/>
        </array>
      </context>
    </context>
  </properties>
</Config>

Dann nur noch der Aufruf:


 Nevada.Config.Load (@"dateiname.xml");

und alle properties und objekte sind in der objektregistry bzw. propertysystem registriert und einsatzbereit

Schlagwörter: <Properites,Eigenschaften>

1.433 Beiträge seit 2006
vor 16 Jahren

Wäre vielleicht das Einsatzgebiet und der Zweck vielleicht noch erwähnenswert, da sich nicht nur Profis sondern auch Einsteiger und weniger Erfahrene hier tummeln.

Grüsse
Daniel
Space Profile
Wer nicht fragt, der nicht gewinnt

E
ernsti Themenstarter:in
38 Beiträge seit 2005
vor 16 Jahren

Das Property-System soll dazu dienen, Properties global zur Verfügung zu stellen und ausserdem dazu, die Properties in XML-Dateien angeben zu können, die dann AUTOMATISCH in das Property-System eingetragen werden, ohne eine Zeile Code zu schreiben. Diese Unterstützung muss ich noch machen, wenn das fertig ist wird es gepostet.

U
239 Beiträge seit 2006
vor 16 Jahren

Das ist ein einfaches System? Ich möchte gar nicht wissen wie dann etwas kompliziertes aussieht. X(