Exemplo n.º 1
0
        private bool TryGetValueByRemovingTheAreaString(AreaDefinition source, string line, out string value)
        {
            // Take the area string as the "substitute" and remove the length in hope...
            value = line.Remove(0, source.AreaString.String.Length);

            return(true);
        }
Exemplo n.º 2
0
        private bool TryGetValueByRemovingTheAreaString(AreaDefinition source, string line, out string value)
        {
            // Take the area string as the "substitute" and remove the length in hope...
            value = line.Remove(0, source.AreaString.String.Length);

            return true;
        }
Exemplo n.º 3
0
        public AreaLineInformation(AreaDefinition source, string line)
        {
            Value      = GetValueFromLine(source, line);
            AreaString = line.Substring(0, line.Length - Value.Length);

            Value      = Value.Trim();
            AreaString = AreaString.Trim();
        }
Exemplo n.º 4
0
        public AreaLineInformation(AreaDefinition source, string line)
        {
            Value = GetValueFromLine(source, line);
            AreaString = line.Substring(0, line.Length - Value.Length);

            Value = Value.Trim();
            AreaString = AreaString.Trim();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="AreaTreeNode"/> class.
        /// </summary>
        public AreaTreeNode()
            : base()
        {
            NodeType  = FaxHierarchyTreeNodeType.Area;
            this.Text = "Bereich";

            this.Definition = new AreaDefinition();
            this.Tag        = Definition;
        }
Exemplo n.º 6
0
        public string GetValueFromLine(AreaDefinition source, string line)
        {
            string value = null;

            if (!TryGetValueByAssertingSeparator(source, line, out value))
            {
                TryGetValueByRemovingTheAreaString(source, line, out value);
            }

            return(value);
        }
Exemplo n.º 7
0
        public string GetValueFromLine(AreaDefinition source, string line)
        {
            string value = null;

            if (!TryGetValueByAssertingSeparator(source, line, out value))
            {
                TryGetValueByRemovingTheAreaString(source, line, out value);
            }

            return value;
        }
Exemplo n.º 8
0
        private bool TryGetValueByAssertingSeparator(AreaDefinition source, string line, out string value)
        {
            value = null;

            int iColon = line.IndexOf(source.Separator);
            if (iColon == -1)
            {
                return false;
            }

            iColon += 1;

            value = line.Remove(0, iColon).Trim();
            return true;
        }
Exemplo n.º 9
0
        private bool TryGetValueByAssertingSeparator(AreaDefinition source, string line, out string value)
        {
            value = null;

            int iColon = line.IndexOf(source.Separator);

            if (iColon == -1)
            {
                return(false);
            }

            iColon += 1;

            value = line.Remove(0, iColon).Trim();
            return(true);
        }
Exemplo n.º 10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SectionDefinition"/> class.
        /// </summary>
        /// <param name="element">The XML-element to read the data from.</param>
        public SectionDefinition(XElement element)
            : this()
        {
            this.SectionString.String      = element.TryGetAttributeValue("Text", null);
            this.SectionString.IsContained = element.TryGetAttributeValue("Text-IsContained", true);

            // Parse the areas...
            foreach (XElement areaE in element.Elements("Area"))
            {
                AreaDefinition areaDefinition = new AreaDefinition(areaE);
                if (!areaDefinition.IsValidDefinition())
                {
                    // TODO: Log warning
                    continue;
                }

                this.Areas.Add(areaDefinition);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SectionDefinition"/> class.
        /// </summary>
        /// <param name="element">The XML-element to read the data from.</param>
        public SectionDefinition(XElement element)
            : this()
        {
            this.SectionString.String = element.TryGetAttributeValue("Text", null);
            this.SectionString.IsContained = element.TryGetAttributeValue("Text-IsContained", true);

            // Parse the areas...
            foreach (XElement areaE in element.Elements("Area"))
            {
                AreaDefinition areaDefinition = new AreaDefinition(areaE);
                if (!areaDefinition.IsValidDefinition())
                {
                    // TODO: Log warning
                    continue;
                }

                this.Areas.Add(areaDefinition);
            }
        }
Exemplo n.º 12
0
 private bool IsLineAreaRelevant(string line, SectionDefinition currentSection, out AreaDefinition area)
 {
     area = currentSection.GetArea(line);
     return area != null;
 }
Exemplo n.º 13
0
 private void WriteValueToOperation(string value, AreaDefinition area, Operation operation)
 {
     // First check: Check if the object has the property we want right away
     PropertyInfo piLocal = operation.GetType().GetProperty(area.MapToPropertyName, BindingFlags.Public | BindingFlags.Instance | BindingFlags.IgnoreCase);
     if (piLocal != null)
     {
         WriteValueToProperty(value, piLocal, operation);
     }
     else
     {
         PropertyInfo piCustomData = operation.GetType().GetProperty("CustomData");
         WriteValueToCustomData(value, area, piCustomData, operation);
     }
 }
Exemplo n.º 14
0
        private void WriteValueToCustomData(string value, AreaDefinition area, PropertyInfo piCustomData, Operation operation)
        {
            // We know that the CustomData-object is a dictionary with string, object...
            IDictionary<string, object> customData = (IDictionary<string, object>)piCustomData.GetValue(operation, null);

            // If the custom data entry already exists, give a warning and overwrite it
            if (customData.ContainsKey(area.MapToPropertyName))
            {
                Logger.Instance.LogFormat(LogType.Warning, this, "The custom data entry '{0}' does already exist and is being overwritten. Please check your control file if this is the intended behavior!", area.MapToPropertyName);
            }
            customData[area.MapToPropertyName] = value;
        }