示例#1
0
        /// <summary>
        /// Generates an object from its XML representation.
        /// </summary>
        /// <param name="reader">The <see cref="T:System.Xml.XmlReader"/> stream from which the object is deserialized.</param>
        public void ReadXml(System.Xml.XmlReader reader)
        {
            try
            {
                _ConsistencyMap.Clear();
                reader.Read();

                while (reader.NodeType != XmlNodeType.EndElement)
                {
                    if (reader.Name != "ConsistencyCheckRegion")
                    {
                        Logger.LogError("The 'ConsistencyCheckRegion' element is missing");
                    }
                    reader.MoveToNextAttribute();
                    if (reader.Name != "Region")
                    {
                        Logger.LogError("The 'Region' attribute is missing");
                    }
                    string region = reader.Value;
                    reader.Read();

                    Dictionary <ConsistencyType, bool> dictType = new Dictionary <ConsistencyType, bool>();

                    while (reader.NodeType != XmlNodeType.EndElement)
                    {
                        if (reader.Name != "Consistency")
                        {
                            Logger.LogError("The 'ConsistencyCheckRegion' element is missing");
                        }
                        reader.MoveToNextAttribute();
                        if (reader.Name != "Type")
                        {
                            Logger.LogError("The 'Type' attribute is missing");
                        }
                        string type = reader.Value;
                        reader.MoveToNextAttribute();
                        if (reader.Name != "Value")
                        {
                            Logger.LogError("The 'Value' attribute is missing");
                        }
                        string          value    = reader.Value;
                        ConsistencyType consType = (ConsistencyType)Enum.Parse(typeof(ConsistencyType), type, false);
                        dictType[consType] = Convert.ToBoolean(value);

                        reader.Read();
                    }

                    ConsistencyCheckRegion consRegion = (ConsistencyCheckRegion)Enum.Parse(typeof(ConsistencyCheckRegion), region, false);
                    _ConsistencyMap[consRegion] = dictType;
                    reader.Read();
                }

                reader.Read();
            }
            catch (Exception ex)
            {
                Logger.LogCritical("ReadXml() throws an exception: ", ex);
            }
        }
示例#2
0
 /// <summary>
 /// Legt fest, ob ein bestimmter Konsistenzalgorithmus genutzt wird oder nicht.
 /// </summary>
 /// <param name="region">Zeitpunkt, wo der Algorithmus ausgeführt werden könnte..</param>
 /// <param name="type">Bestimmt die Art des Konsistenzalgorithmuses.</param>
 /// <param name="active">if set to <c>true</c> [active].</param>
 public void SetCheckConsistencyActive(ConsistencyCheckRegion region, ConsistencyType type, bool active)
 {
     _ConsistencyMap[region][type] = active;
 }
示例#3
0
 /// <summary>
 /// Gibt zurück, ob der Konsistenzalgorithmus genutzt wird oder nicht.
 /// </summary>
 /// <param name="region">Zeitpunkt, wo der Algorithmus ausgeführt werden könnte.</param>
 /// <param name="type">Bestimmt die Art des Konsistenzalgorithmuses.</param>
 /// <returns>true or false</returns>
 public bool GetCheckConsistencyActive(ConsistencyCheckRegion region, ConsistencyType type)
 {
     return(_ConsistencyMap[region][type]);
 }